 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
cirudinezidane@gmail.com Guest
|
Posted: Tue May 15, 2007 4:10 am Post subject: Use a C# dll from Java |
|
|
Hi!
I would like to use a chsarp dynamic library from my Java application.
How I can use all functions from Java? I am beginner in Java but I
read about jni.
Thanks.
Greetings |
|
| Back to top |
|
 |
Gordon Beaton Guest
|
Posted: Tue May 15, 2007 10:37 am Post subject: Re: Use a C# dll from Java |
|
|
On 14 May 2007 16:10:27 -0700, cirudinezidane (AT) gmail (DOT) com wrote:
| Quote: | I would like to use a chsarp dynamic library from my Java
application. How I can use all functions from Java? I am beginner in
Java but I read about jni.
|
If you have an existing DLL it doesn't matter what language it was
written in, as long as its functions can be called using C calling
conventions.
To use the DLL from Java, write a set of wrapper methods in C that can
be called from Java according to the rules of JNI, and create a new
DLL from those. From there you can call the functions in the DLL.
i.e. Java => new (JNI) DLL => existing C# DLL
/gordon
-- |
|
| Back to top |
|
 |
Ian Wilson Guest
|
Posted: Tue May 15, 2007 2:01 pm Post subject: Re: Use a C# dll from Java |
|
|
Gordon Beaton wrote:
| Quote: | On 14 May 2007 16:10:27 -0700, cirudinezidane (AT) gmail (DOT) com wrote:
I would like to use a chsarp dynamic library from my Java
application. How I can use all functions from Java? I am beginner
in Java but I read about jni.
If you have an existing DLL it doesn't matter what language it was
written in, as long as its functions can be called using C calling
conventions.
To use the DLL from Java, write a set of wrapper methods in C that
can be called from Java according to the rules of JNI, and create a
new DLL from those. From there you can call the functions in the DLL.
i.e. Java => new (JNI) DLL => existing C# DLL
|
That's interesting. If I use C# to create MyApp.exe I can't run it on a
PC that doesn't have a CLR installed (.NET, Mono, etc.) This is
obviously because the file MyApp.exe contains CIL not x86 object code.
I've assumed the DLL's produced by C# similarly contain CIL and are not
normal DLLs and also depend on the CLR.
So would that be
Jar/Class => JVM => JNI => DLL(C) => CLR => DLL(C#)
How much of this applies to non-MS platforms using Mono or dotGNU? |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|