Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / July 2006

Tip: Looking for answers? Try searching our database.

JNI problems, dll generation with Visual studio 8, repost

Thread view: 
Krishna - 17 Jul 2006 07:17 GMT
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.
EJP - 18 Jul 2006 02:21 GMT
> 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.
Krishna - 19 Jul 2006 06:35 GMT
> > should i generate the dll with /MT option or /MD option. my dll
> > implements  heavy math computations. what steps should i take if my
[quoted text clipped - 7 lines]
> 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.
EJP - 19 Jul 2006 06:47 GMT
> 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.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.