[Mono-dev] R <-> mono: linking to libmono.a on windows (cygwin) problems

Jonathan Shore jonathan.shore at gmail.com
Fri Dec 16 18:04:51 EST 2011

I've developed a bridge between R and mono allowing all CLR hosted classes
/ objects to be visible (callable) from R as 1st class R objects.   This
compiles fine on linux and osx, but having issues on windows.

I am using g++ 3.4.4 (cygmin special, gdc 0.12, using dmd 0.125) under
cygwin.  The compilation is done against a few C++ files, the R library
(compiled with ming-gcc I think), and libmono.a.

A compilation like:

g++ -o rDotNet.dll -I<mono include dir> -L<R libs> -L<mono libs>  *.cpp -lR

compiles everything but complains about all referenced mono symbols as
being undefined, as if the library was not present.   I know that g++ see
the library as if I change the name to a bogus name it complains about it.

Since libmono.a is a "ar", I unarchived it and changed to using:

g++ -o rDotNet.dll -I<mono include dir> -L<R libs> -L<mono libs>  *.cpp -lR

This gets rid of the undefined mono symbols but left with unresolved libc
stuff, such as __errno, and other non clib symbols such as
CoCreateFreeThreadedMarshaler.   Do I need to include another library such
as glib to get this to link?

It is also mysterious that libmono was ignored for linkage unless I
expanded the ar.

Is there a preferred build solution?   For instance should I not be using


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20111216/d5f874ba/attachment.html 

More information about the Mono-devel-list mailing list