HighTechTalks DotNet Forums  

J#/C# integration

Dotnet VJSharp microsoft.public.dotnet.vjsharp


Discuss J#/C# integration in the Dotnet VJSharp forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Wizard1027
 
Posts: n/a

Default J#/C# integration - 03-22-2005 , 03:45 PM






I'm trying to integrate some program logic written in J# with a C# GUI.
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, and more generally in finding information about .NET's
cross-langauge support itself.

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)?

2. Better yet, does anyone have a detailed, step-by-step tutorial on
how to set all of 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, or vice-versa?


Thanks!


Reply With Quote
  #2  
Old   
Bruno Jouhier [MVP]
 
Posts: n/a

Default Re: J#/C# integration - 03-23-2005 , 02:32 AM






Mixing C# and J# is straightforward. You don't need any tool in between.

The only restriction is that you have to organize the code in separate
assemblies (you cannot mix C# and J# in a single assembly). For example, if
your business logic is in J#, you should compile it as one assembly (dll).
Then, you can build your UI in C# around it, as another assembly (exe), you
just need to put the 2 projects (UI and business logic) into a single
solution, and add a reference from the C# project to the J# project. Then,
you can instantiate the J# classes from C# and call their methods as if they
were written in C# (we do it every day and it works really well).

If you want to build in batch, you can use NAnt. But you'll be able to build
the whole solution in one click with Visual Studio .NET.

Bruno.

"Wizard1027" <Wizard1027 (AT) aol (DOT) com> a écrit dans le message de news:
1111524359.842424.60630 (AT) z14g200...oglegroups.com...
Quote:
I'm trying to integrate some program logic written in J# with a C# GUI.
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, and more generally in finding information about .NET's
cross-langauge support itself.

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)?

2. Better yet, does anyone have a detailed, step-by-step tutorial on
how to set all of 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, or vice-versa?


Thanks!




Reply With Quote
  #3  
Old   
George Birbilis [MVP J#] [9880]
 
Posts: n/a

Default Re: J#/C# integration - 04-02-2005 , 04:09 AM



Quote:
Mixing C# and J# is straightforward. You don't need any tool in between.
btw, you can also structure your code using interfaces:

that is define ALL your API using interface classes in say C# and then
implement those interfaces at various classes written in C# and J# as
needed. All C# and J# "client" code that calls into this API will reference
the assembly that has the interfaces (better separate them in one assembly
in this case) and so will do the "server" code, the code that implements the
interfaces that is.

To instantiate the classes you can use a Factory class with static methods
that knows the discrete implementation classes and can return instances of
them as the respective interface refs (instead of as class refs)

e.g.

public static IMyColoredObject CreateColoredObject(){
new TMyColoredObject(); //can also write "new
IMyColoredObject(TMyColoredObject)" although I think it's implied in Java
(don't remember for sure) if TMyColoreObject class implements the
IMyColoredObject interface
}

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
George Birbilis <birbilis (AT) kagi (DOT) com>
Microsoft MVP J# for 2004, 2005
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ QuickTime controls (Delphi & ActiveX: VB, PowerPoint, .NET)
+ Plugs (InterProcess/Internet communication)
+ TranXform (VB6 form to ASP.net WebForm convertion)
http://www.kagi.com/birbilis
+ Robotics
http://www.mech.upatras.gr/~robgroup
.................................................. .......................




Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.