Yes no problem. It's called a "CCW". Com Callable Wrapper (or something like
that).
Here is one example:
1. Open Visual Studio.
2. Make a new J# Class Library project.
3. Add an interface to your classes:
package JCOMTest;
public interface ITest
{
/** @property */
public void set_Value( int number );
/** @property */
public int get_Value( );
}
public class Class1 implements ITest
{
private int number;
public Class1()
{
}
/** @property */
public void set_Value( int number )
{
this.number = number;
}
/** @property */
public int get_Value( )
{
return this.number;
}
}
4. Make a string name using the "sn" utility.
c:\....the project folder\> sn -k yourkey.snk
5. Add the filename to the "AssemblyInfo.jsl" file.
/** @assembly AssemblyKeyFile("yourkey.snk") */
6. Ctrl + Shift + B (Build solution)
7. In the bin\debug folder:
8. Create a type library and register it in the registry.
c:\....the project folder\bin\debug> regasm JCOMTest.dll
/tlb:JCOMTest.tlb
9. You should now either copy the dll to the clinet folder, or put it in the
Global Assembly Cache.
c:\....the project folder\bin\debug> gacutil /i JCOMTest.dll
10. Ok, It should now be ready.
11. Open Tools + Ole/COM Object Viewer in Visual Studio.
12. Click on "All Object"
13. Find "JCOMTest.Class1"
14. You should now find the "ITest" interface, double click it and click on
"View Type Info".
(Remember to "release instance", right click "JCOMTest.Class1").
15. If you want to unregister it:
16. c:\....the project folder\bin\debug> gacutil /u JCOMTest.dll
17. c:\....the project folder\bin\debug> regasm JCOMTest.dll /unregister
Regards,
Lars-Inge Tønnessen
www.larsinge.com