我试图使用从Java code一个.NET的DLL(通过一个C ++本机code)。
I am trying to use a .NET DLL from Java code ( Through a C++ native code).
流程是这样的。
创建.NET的DLL利用Visual Studio 2010中的C#类库类型的项目。
Created .net DLL using C# class library type project from visual studio 2010.
创建本地C ++ code(控制台应用程序),使用此DLL 使用该步进一步从微软指南这code是能够成功调用DLL code。
Created native C++ code (Console application) to use this DLL Using this step-by-step guide from Microsoft This code is able to successfully calls DLL code.
写的Java code与一些本地方法,生成的头和实施的头在C ++ DLL项目(相关方法搬到原来的code从例子,做了一些变数全球)。
Wrote Java code with some native methods, generated headers and implemented header in C++ DLL project(moved original code from example in relevant methods,made some variables global).
此DLL加载成功,但是在建立接口指针管理类code失败。
This DLL is loaded successfully, but the code fails while creating Interface pointer for Managed class.
看剪断从微软指南
// Create the interface pointer.
ICalculatorPtr pICalc(__uuidof(ManagedClass));
请注意,这个调用成功返回控制台应用程序,但是当叫虽然JNI流,JVM崩溃。
Please note this call returns successfully for console application, but when called though JNI flow, JVM crashes.
推荐答案
我的Java code的在64位JVM上运行,更换了32位之一,并没有更多的JVM崩溃。
My java code was running within a 64bit JVM, replaced in with a 32bit one and no more JVM crashes.
相关推荐
最新文章