I am creating a shared library Client.dll using Cygwin g++ compiler and calling through a JAVA program.
Everything is working fine if I remove 'cout <<' command from Client.c program. The method returns the value. But when I add cout command the JVM freezes.
Client.c has :
JNIEXPORT jint JNICALL Java_nativeCode_Client_getDummyData(JNIEnv * env, jobject obj, jint pmuId)
jint myint = 11;
pmuId = pmuId + pmuId;
I am creating .dll as,
$ g++ -I"C:\Program Files (x86)\Java\jdk1.6.0_33\include" -I"C:\Program Files (x86)\Java\jdk1.6.0_33\include\win32" -Wl,--add-stdcall-alias -shared -o Client.dll Client.c
What am I doing wrong?
Thanks in advance.
A DLL is not guaranteed to have a console when run, and even if it does, maybe the variable cout is not properly linked for starters. Is this Java program of yours providing a console?
yes....I have created an eclipse Java project that is accessing the DLL.