JNI problems, dll generation with Visual studio 8, repost


K

Krishna

Hi,
I am trying to generate a dll with JNI interface using c++ and visual
studio 2005, java sdk 1.6beta2.
should i generate the dll with /MT option or /MD option. my dll
implements heavy math computations. what steps should i take if my
java application should run in a fresh system that does not have visual
studio installed.
this is a re-post from comp.lang.c++ as i was informed that my question
does not fit into that group..

any help/suggestion would be helpful.

thanks,
krishna.
 
Ad

Advertisements

E

EJP

Krishna said:
should i generate the dll with /MT option or /MD option. my dll
implements heavy math computations. what steps should i take if my
java application should run in a fresh system that does not have visual
studio installed.

From memory /MD but it's a long time ago, anyway the one with the
shared C library DLL.

All Windows systems have one or more versions of MSVCRTxx.DLL installed
and that's all your DLL will need. Your installer can make sure the
right version is there, or install it if absent. Don't ask me how.
 
K

Krishna

EJP said:
From memory /MD but it's a long time ago, anyway the one with the
shared C library DLL.

All Windows systems have one or more versions of MSVCRTxx.DLL installed
and that's all your DLL will need. Your installer can make sure the
right version is there, or install it if absent. Don't ask me how.

Thanks. I was confused about the fact that my c++ dll uses msvcr80.dll,
but jre uses the msvcr71.dll. Anyways, I was able to get it working.
One observation is that when i use JVM to call my dll, my application
crashes, but when i use the dll in C++, it does not crash. (jni
interface fn is a wrapper, which in-turn calls the c++ fns in dll).
there is no problem with parameter translation from jobects to c++. I
was able to track it down to memory alloc-dealloc some-where deep
inside my processing in c++ dll.
I wanted to know if I have to take any particular steps if i intend to
call my dll fns through jni interface.
thanks,
krishna.
 
E

EJP

Krishna said:
One observation is that when i use JVM to call my dll, my application
crashes, but when i use the dll in C++, it does not crash.

Hmm. If this is still a problem maybe you should try /MT. Anyway be sure
that any memory allocated inside the DLL is freed inside the same DLL.
 
Ad

Advertisements

Joined
Oct 16, 2007
Messages
1
Reaction score
0
Facing the same problem !!

Krishna,.. I am facing the same problem as you encounted. Can you please let me know the resolution for this problem ?
 

Top