我有一个原始的Dll文件,但没有相关的lib文件,所以我使用jni技术,做一个新的dll文件,使用这个新dll的函数来调用原有的dll文件中的函数。有点绕,不知说没说明白。
在Testdll.cpp里代码有(通过它将生成TestDll.dll文件):
typedef char* (CLP)(char*,char*);
HINSTANCE hInstance;
CLP *pFunction;
hInstance=::LoadLibrary("Clp.dll");
pFunction=(CLP*)::GetProcAddress(hInstance,"Clp");
char* Buffer;
Buffer = (char *)malloc(100000*sizeof(char));
printf("Get the space of Buffer\n");
Buffer=(*pFunction)(m_sBuffer,"demo.");
printf("get the Buffer and begin to printf the file");
我用我的java代码来调TestDll.dll
         会显示printf("Get the space of Buffer\n");
         但不会显示printf("get the Buffer and begin to printf the file");
         这说明在Buffer=(*pFunction)(m_sBuffer,"demo.");出错
并会报下面的错误:
An unrecoverable stack overflow has occurred.An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : EXCEPTION_STACK_OVERFLOW occurred at PC=0x10069317
Function=[Unknown.]
Library=D:\programe\DLL\DllGraph\DllTest\Debug\Clp.dllNOTE: We are unable to locate the function name symbol for the error
      just occurred. Please refer to release documentation for possible
      reason and solutions.而同样的代码我放在普通的c程序中去调用CLP.dll,则完全正常,真的很困惑。
哪位高手,有好的建议一定给高分!在线等待!