JVM gives a Microsoft Visual C++ Debug Library error!! Help!

Hello,

I have the following problem:

When I execute "java main" a window pops up with the following error:

Microsoft Visual C++ Debug Library

Debug Assertion Failed!

Program: c:\j2sdk1.4.2_09\bin\java.exe

File: app3ds.cpp

Line:32 ASSERT(!afxContextIsDLL); // Should only be called by apps

If I press "Ignore" I then get a "java.lang.UnsatisfiedLinkError: D:\...\Hmi_HITDlg.dll: A dynamic link library (DLL) initialization routine failed."

If I press "Retry" I get a java.lang.UnsatisfiedLinkError: D:\..Hmi_HITDlg.dll: One or more arguments are invalid.

What I am actually trying to do is call a C++ function from Java using JNI (JNI code is generated using SWIG).

Here is my C++ function (in HMI_HITDlg.cpp):

-

float get_LongVel() {

return myInput.Vehicle.LongVel;

}

-

This is my JNI code (in HMI_HITDlg_wrap.cxx)

-

JNIEXPORT jfloat JNICALL Java_Hmi_1HITDlgJNI_get_1LongVel(JNIEnv *jenv, jclass jcls) {

jfloat jresult = 0 ;

float result;

(void)jenv;

(void)jcls;

result = (float)get_LongVel();

jresult = (jfloat)result;

return jresult;

}

--

This is the code where I am loading the dynamic link library Hmi_HITDlg.dll (contains HMI_HITDlg.cpp and HMI_HITDlg_wrap.cxx and other necessary files and is made using Visual C++ 6.0, from File->New->Projects->Win32 Dynamic-Link Library) in main.java:

-

System.loadLibrary("Hmi_HITDlg");

The size of the DLL that I am loading is approx. 2.04MB .

What is going on here? Please help!!

[1639 byte] By [el_grecoa] at [2007-10-2 10:35:02]
# 1
can u tryjava -Xcheck:jni -Djava.library.path=<directory where Hmi_HITDlg.dll resides> main
fuishiena at 2007-7-13 2:35:30 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...