C#/J# Integration

G

Guest

I'm trying to integrate two pieces of code, one written in J# and the other
in C#. Although there is a single entry point for the program (in the J#
code), objects in each need to be able to instantiate and call methods on
objects in the other. I'm having trouble finding a way to compile this code.

The only good cross-language sample I've seen is the CrossLanguageDev that
comes with VS, but the files in that sample can be compiled in a certain
order to avoid generating ambiguities. I can't do that with my code
(certianly not easily, and possibly not at all).

1. Are there any other good cross-language examples available (especially
examples that use J# as one of the languages)? Does anyone have a
step-by-step tutorial on setting this up?

2. Is it possible to compile all of the code (both J# and C#) in one batch?
If not, is there any way I can compile the J# without errors because the C#
is missing, and vice-versa?

3. As a specific case, how can I compile a C# class and then instantiate it
in J#?


Thanks
 
G

Guest

If it helps any, my current attempt to write a build.bat file (along the
lines of the VS example) is:

@ REM Set command switch for building debug or retail (default is to build
debug)
@ REM Type "build.bat -r" to build for retail
@ SET DEBUGSAMPLE=/debug+
@ IF "%1"=="-r" SET DEBUGSAMPLE=/debug-
@ IF "%1"=="-R" SET DEBUGSAMPLE=/debug-
@ SET DEBUGSAMPLEVC=/Zi
@ IF "%1"=="-r" SET DEBUGSAMPLEVC=
@ IF "%1"=="-R" SET DEBUGSAMPLEVC=

csc %DEBUGSAMPLE% /t:module /out:kelthasInterface.il *.cs
ilasm /DLL /out=kelthasInterface.netmodule kelthasInterface.il
vjc %DEBUGSAMPLE% /addModule:kelthasInterface.netmodule /recurse:*.java


Both ilasm and vjc report errors and fail.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top