[Mono-devel-list] Building embed sample or cilc generated code on Windows

Paolo Molaro lupus at ximian.com
Thu Jun 12 11:38:34 EDT 2003

On 06/10/03 Candace Bain wrote:
> I'm working on a proof of concept application that will need to call
> from a C++ command line application into a C# object running under mono.
> For performance testing I'll need to run the same app the same way on
> both Linux and Windows.  I've been looking at the embed sample
> application under /mono/samples/embed and the code that the cilc test
> generates under /mcs/tools/cilc/generated, both of these work as
> expected for me when I compile and run them on Linux.  I'm not able to
> compile either of them on Windows.  The instructions for teste.c in
> embed are to run:
> gcc -o teste teste.c `pkg-config --cflags --libs mono` -lm
> And the Makefile that cilc generates contains:
> gcc -Wall -fpic -shared `pkg-config --cflags --libs glib-2.0 mono`
> -lpthread *.c -o libdemo.so

Those instructions are for unixy kind of systems.
I think on windows you'll have to add at least -mno-cygwin to gcc.

> If I run pkg-config --cflags --libs glib-2.0 mono manually it works and
> returns:
> -IC:/cygwin/users/candace/install/include
> -I/users/candace/install/include/glib-2.0
> -I/users/candace/install/lib/glib-2.0/include  -Wl,--export-dynamic
> -LC:/cygwin/users/candace/install/lib -L/users/candace/install/lib
> -lmono -lm -lgmodule-2.0 -lglib-2.0 -lintl -liconv
> >From the errors I'm getting (can't find mono/io-layer/wapi.h, etc) it
> seems clear to me that I need to use some specific header include paths
> and defines for Windows, but I haven't been able to get a combination
> that works yet.  Does anyone have a Makefile I could use to compile the
> embed sample or cilc generated test on Windows, or if not does anyone
> have pointers to where I could gather this information?

The only header from io-layer that shuld be installed is io-layer.h:
check you have installed it somewhere.
That header uses 
#if defined(__WIN32__)
to include the windows headers on windows, instead of wapi.h etc.
So it may be that the compiler doesn't define __WIN32__, seems strange
though. Hope this helps.


lupus at debian.org                                     debian/rules
lupus at ximian.com                             Monkeys do it better

More information about the Mono-devel-list mailing list