Bug in calling C function on Windows?

Bradley Smith digitalmars-com at baysmith.com
Mon Jan 8 23:31:01 PST 2007


I'm experimenting with using D for Java Native Interface (JNI) 
programming. I may have encountered a bug with GDC calling a C function 
in the JavaVM invocation API. The following is the relevant code.

JNI_CreateJavaVM(&jvm, cast(void**)&env, &vm_args);
version (gdcBugWorkaround) {
   // Any statement can go here (even "int x = 0;")
   assert (jvm !is null, "JNI_CreateJavaVM failed");
}

For some reason, the program will crash unless some kinds of statements 
follow the call to JNI_CreateJavaVM. Is this a bug?

The full code and a build.bat script are in the attached zip. I'm using 
gdc --version: "gdc (GCC) 3.4.5 (mingw special) (gdc 0.21, using dmd 1.00)"

Thanks,
   Bradley
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gdcBug.zip
Type: application/octet-stream
Size: 12673 bytes
Desc: not available
Url : http://lists.puremagic.com/pipermail/d.gnu/attachments/20070108/e9970951/attachment.obj 


More information about the D.gnu mailing list