Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com From: sjc AT qx DOT net To: cygwin AT sources DOT redhat DOT com Subject: DLL runtime problems Date: Thu, Aug 3 2000 16:37:05 GMT-0400 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <7736CDC0D7E.AAA12D8@mail2.qx.net> I am trying to implement a Java JNI call into a DLL compiled by Cygwin's gcc. I've gotten everything to compile correctly but running the example causes an application error and kills the JVM. I've been doing some asking around, and have learned that there are differences between __stdcall and __cdecl methods for calling into DLLs. The existence of the @ symbols and use of WINAPI in the Cygwin example indicate that __stdcall is being used. Does anyone know how JNI is implemented on the Windows NT4 platform, either __stdcall or __cdecl, and whether or not gcc can create __cdecl DLLs if that's what the Windows NT4 JDK uses? I'm not an experienced Windows programmer, so I maybe confusing the terminology. Also, is there any more information someone could point me to concerning the meaning of the @12 in the example in case that number should be different for my example? The files are so simple I've included them here: HelloNative.h: /* DO NOT EDIT THIS FILE - it is machine generated */ #include /* Header for class HelloNative */ #ifndef _Included_HelloNative #define _Included_HelloNative #ifdef __cplusplus extern "C" { #endif /* * Class: HelloNative * Method: greeting * Signature: ()V */ JNIEXPORT void JNICALL Java_HelloNative_greeting (JNIEnv *, jclass); #ifdef __cplusplus } #endif #endif HelloNative.c: #include "HelloNative.h" #include #include int WINAPI HelloNative_init (HANDLE h, DWORD reason, void *foo) { return 1; } JNIEXPORT void JNICALL Java_HelloNative_greeting (JNIEnv* env, jclass cl) { printf("Hello, Native World!\n"); } main() { } HelloNative.def: EXPORTS Java_HelloNative_greeting HelloNative.java: class HelloNative { public native static void greeting(); static { System.loadLibrary("HelloNative"); } } HelloNativeTest.java: class HelloNativeTest { public static void main( String[] args ) { HelloNative.greeting(); } } Thanks for any help. Stuck in DLL HELL, Steve -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com