Reputation: 572
I am trying to use a .NET DLL from Java code ( Through a C++ native code).
Flow is like this.
Created .net DLL using C# class library type project from visual studio 2010.
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.
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).
This DLL is loaded successfully, but the code fails while creating Interface pointer for Managed class.
see snipper from microsoft guide
// Create the interface pointer.
ICalculatorPtr pICalc(__uuidof(ManagedClass));
Please note this call returns successfully for console application, but when called though JNI flow, JVM crashes.
Upvotes: 4
Views: 6810
Reputation: 572
My java code was running within a 64bit JVM, replaced in with a 32bit one and no more JVM crashes.
Upvotes: 1