[Mono-list] Mono with other languages
Erven ROHOU
erven.rohou at st.com
Mon Feb 11 12:04:26 EST 2008
Jonathan Pryor a écrit :
> On Mon, 2008-02-11 at 10:40 +0000, Dan Smithers wrote:
>> Jonathan Pryor wrote:
>>> So the only real questions are:
>>>
>>> 1. What language do you want to use?
>> C++, Python
>>
>>> 2. Does that language have a compiler that runs on Linux?
>> several - I would probably use gcc for C++.
>
> gcc doesn't support C++/CLI. Additionally, gcc doesn't (at this time)
> support generating IL.
Actually, we have been working on a port of GCC that emits IL.
It currently is in the branch st/cli of the repository. You can also
take a look here: http://gcc.gnu.org/projects/cli.html
At this time, no library is provided (we plan to release a libc-like
library soon), but the code generator should work.
C++ will not work though. But if GCC does most of the lowering, it might
not be _too_ difficult to get some things working.
--
Erven.
>> I suppose I should explain a bit about what I'm trying to achieve.
>>
>> We have core software developed under Linux, that we are hoping to make
>> accessible to Windows developers across a network. We are planning to do
>> this using network communication and also by exposing parts of the core
>> libraries.
>
> Are these actual C/C++ dynamic (not static) libraries, or C/C++
> programs?
>
> If these are dynamic libraries, you can write a C wrapper API, then
> use .NET Platform Invoke to write a set of wrapper classes that invoke
> the wrapper. Alternatively, you can use SWIG to generate the C and C#
> wrappers that would be needed to interact with your C++ API:
>
> http://www.mono-project.com/dllimport
> http://www.swig.org
>
> Once the wrapper layer is written & compiled, any managed language will
> be able to run against the wrapper layer, and (indirectly) use your
> libraries. Examples of this approach include Mono.Posix.dll and Gtk#.
>
> If this is a C/C++ program, you can use Mono's embedding interface so
> that your program acts as a host for managed code, and then you can
> provide "internal calls" so that managed code can invoke your exported
> methods:
>
> http://www.mono-project.com/Embedding_Mono
>
> Second Life is embedding mono to run their scripting engine:
>
> http://blog.secondlife.com/2008/01/29/mono-beta-launch/
> http://www.mono-project.com/Scripting_With_Mono
>
>> To do this I want to provide an interface that can be used from Windows
>> (i.e. .Net) platforms and implemented in an agnostic way. Mono seems a
>> natural choice for this, but I am getting rather frustrated by C#.
>
> The "shared libraries + P/Invoke" approach will work across both Mono
> and .NET, while the "embedding mono" approach is tied to Mono.
>
> - Jon
>
>
> _______________________________________________
> Mono-list maillist - Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
More information about the Mono-list
mailing list