C# Interface?

Peter Caven <>
Thu Feb 27 13:43:00 CET 2003


Shawn Pearce asks:

> Anyone attempt a C# interface yet?
>

Yes, I actually used the JLCA facility with Visual Studio to convert
JInterace 1.2.1 to C#,
and then I spent quite a lot of time improving the converted code,
(for example, to use System.String instead of the Java String class, and
other things).
The incompatibilities between the native CLR strings and the Java String
classes cause problems
when using the Java code as a component in a larger project.

My goal was to build .Net applications, with a Windows.Forms user interface,
that could communicate with Erlang nodes, by using JInterface as a
communication component.

I have not fully reached that goal- it works, but the converted code still
needs some rework.

JInterface itself has some underlying problems - for example, message
processing that is purely FIFO (unlike real Erlang),
leading to deadlocks in my application.

What I would really like to have is a managed code version of the Beam DLL,
(either as a real .Net assembly or as a native DLL that can be PInvoked),
 that could be dropped into any .Net project, allowing the application to
act as a real Erlang node,
but also with a good user interface.
I also attempted that - but the horrors of that experiment are better left
unmentioned - suffice it to say that it's like trying
to build Erlang natively on Win32 but with 100 times the difficulty :-)

Another path forward might be to write a new remoting channel that can
serialize and deserialize the Erlang binary term format,
and also communicate with the epmd.

If anyone is interested in the converted JInterface code in its current
form, I'd be happy to provide it.
I don't think I'll be able to spend any more time on it right now - but
maybe somebody else would like
to continue with it.

-- Peter



> Specifically I'm thinking about C# classes which can parse and
> create the external binary format.  I don't want to use it
> for node to node messaging, but more along the lines of using
> term_to_binary/1 and binary_to_term/1 and pipe directly over
> raw SSL sockets to C# applications.
>
> I'm going to have too many connected clients to use standard
> Erlang messaging, and I can't trust them either to send messages
> only to 'proper' servers.  :-(
>
> I was thinking, isn't the JInterface stuff using the same binary
> term format?  Might it be possible to use JInterface running in
> J# to do the binary parsing and creating at my "client" end?
>
> --
> Shawn.
>
>   Delay not, Caesar.  Read it instantly.
>   -- Shakespeare, "Julius Caesar" 3,1
>
>   Here is a letter, read it at your leisure.
>   -- Shakespeare, "Merchant of Venice" 5,1
>
>   [Quoted in "VMS Internals and Data Structures", V4.4, when
>   referring to I/O system services.]




More information about the erlang-questions mailing list