Discussion:
[Ikvm-developers] ikvmc
Mohr, Christian
2016-10-21 06:48:18 UTC
Permalink
I'm searching for help when using ikvmc of version 8.1.57.17.0.
My Java application references some jar files that I have created from .NET DLLs using ikvmstub.
After using them I wanted to convert the resulting jar back with ikvmc. It worked out and I got a resulting DLL.
Unfortunately the code inside this DLL does not work on my .NET 4.5.2 environment. The reason is that ikvmc introduces a lot of unboxing conversions to the coding that my c# environment is not able to resolve.
Example:
The line
empMetaData.Id = exampleNodeId;
in my Java application turns into
((EmpMetaData) (object) (EmpMetaData) this.empMetaData).Id = (__Null) EMPJavaExampleImplementation.exampleNodeId;
In the resulting DLL.
But to make it run it should look like this:
empMetaData.Id = exampleNodeId;

EMPMetaData is a struct in c#.
exampleNodeId is a static variable of my java class.

Can anybody give me a hint how my Java code has to look like to prevent ikvmc from unboxing ?
Best regards
Christian
Jeroen Frijters
2016-10-21 07:25:40 UTC
Permalink
Hi Christian,

Java doesn't support value types, so there is no way for IKVM to sensibly support mutable value types.

Regards,
Jeroen
-----Original Message-----
Sent: Friday, October 21, 2016 8:48
Subject: [Ikvm-developers] ikvmc
I'm searching for help when using ikvmc of version 8.1.57.17.0.
My Java application references some jar files that I have created from
.NET DLLs using ikvmstub.
After using them I wanted to convert the resulting jar back with ikvmc.
It worked out and I got a resulting DLL.
Unfortunately the code inside this DLL does not work on my .NET 4.5.2
environment. The reason is that ikvmc introduces a lot of unboxing
conversions to the coding that my c# environment is not able to resolve.
The line
empMetaData.Id = exampleNodeId;
in my Java application turns into
((EmpMetaData) (object) (EmpMetaData) this.empMetaData).Id = (__Null)
EMPJavaExampleImplementation.exampleNodeId;
In the resulting DLL.
empMetaData.Id = exampleNodeId;
EMPMetaData is a struct in c#.
exampleNodeId is a static variable of my java class.
Can anybody give me a hint how my Java code has to look like to prevent
ikvmc from unboxing ?
Best regards
Christian
Loading...