Click here to Skip to main content
15,883,896 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have created a C# project that uses a external dll as reference. I have then created a C++ program that add the C# generated dll as reference, so that I can Invoke the C# function from c++ and then use java jni method call. When I compile the application within visual studio it generate the cpp dll fine. But when I call the cpp dll from java the jvm crashes as the cpp dll cant find the C# dll reference. My question is how can I configure the C++ project so that it combines all the C# dll and its dependancy into one so that call the functions from the C# project from java using jni is successfull?
Posted

1 solution

You need to load the C# from C++. Here is an article of the Dynamic Loading.

The internal problem is, that Java, C++ and C# have own runtime environments, so you need in the project 3 runtimes which must interact. I guess it will be slow and crappy.

BTW: I would recommand NOT using C# from JNI, but wrapping all in C++. Alternativly: think about moving the C# logic to Java,
 
Share this answer
 
Comments
Member 12157311 24-Nov-15 8:13am    
KarstenK I have a device which has been programmed using C# and I need to invoke those methods from java.This is the error that am getting
#
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (0xe0434352), pid=5988, tid=7480
#
# JRE version: 7.0-b147
# Java VM: Java HotSpot(TM) Client VM (21.0-b17 mixed mode, sharing windows-x86 )
# Problematic frame:
# C [KERNELBASE.dll+0x812f]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900