-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
C# and Java interoperability #766
Comments
I believe the only way to do this today would be to use C/C++ as a bridge between the 2 languages. Also be careful as you need to make sure GC references are tracked between the 2 runtimes (if you pass GC handles back and forth). I believe Xamarin Android does this today but I don't know the details. @migueldeicaza this seems up your alley? /cc @jkotas for ideas |
Would IKVM.NET help? http://www.ikvm.net/ |
@karelz |
It seems like I would have a really hard damn time. |
It's quite easy calling Java using Pinvoke and a plain C-wrapper as a go-between that uses JNI to load the JVM and to expose functions that call into Java using JNI. You would have to deal with the restrictions of the JNI though (data types). I've done this in Delphi to call Java. Perhaps there are better possibilities than JNI nowadays, as I haven't used Java for many years. Calling a C# dll from Java could be done using "unmanaged exports" (nuget) to expose c# as a plain C or COMM interface. |
IKVM.NET seems to work only under full .net framework or mono. dotnetcore still missing some api to allow ikvm.net to run... |
Hi guys, I finally achieved this by using JNI to call c++ and use c++ to host a coreclr . It works. |
@heartlocker you should post a sample. I'm sure there are others that would appreciate it. |
The basic code for core CLR host; For Java invoke C#: For C# invoke Java: |
Can anyone pls tell me the steps to follow. What is MakeFile in CSharpCallJava Project? How to build and run it? Thanks. |
I want to bring your attention on the project JCOReflector. |
I want to call java method in c# code and also invoke c# dll in java code.
The environment is Ubuntu 16.10 x64. The c# code is build in .net core 2.0 p1.
Which is the best way to implement?
I try to use c++ as a wrapper. Is the .net core lack of managed c?
The text was updated successfully, but these errors were encountered: