I want to compile libmono as static library at Windows.
Target platform is Windows x86. Build environment: Windows 7 64-bit, VC++ Express 2010
What i have already done.
1) Downloaded mono 2.10.8 sources.
2) Opened mono.sln from msvc folder and ensured that everything is compilling.
3) Then i've made some changes:
3.1) General->Project Defaults->Configuration Type: Static library (.lib)
3.2) General->Project Defaults->Use of MFC: Use Standard Windows Libraries
3.3) C/C++->Code Generation->Runtime Library: Multi-threaded (/MT)
4) Built it and VC++ 2010 successfully created mono-2.0.lib
5) Added it in linker inputs of my own project (that i want to embed mono in) with:
5.1) General->Project Defaults->Configuration Type: Application (.exe)
5.2) General->Project Defaults->Use of MFC: Use MFC in a Ststic Library
5.3) C/C++->Code Generation->Runtime Library: Multi-threaded (/MT)
It seems to work near perfect but with some terrible issues: Mysterious behavior of Dictionary<TKey, TSource>
Is everything done correct? Should i specify any other compiler options or preprocessor directives?
P.S.: libmono command line is:
/I"..\libgc\include" /I"..\" /I"..\mono\" /I"..\mono\jit" /I"..\mono\eglib\src" /I"....\mono\eglib\src" /I"..\eglib\src" /Zi /nologo /W1 /WX- /O1 /Ob1 /Oi /Oy- /D "NDEBUG" /D "i386" /D "TARGET_X86" /D "i386" /D "WIN32" /D "_WIN32" /D "WIN32" /D "_WINDOWS" /D "WINDOWS" /D "HOST_WIN32" /D "TARGET_WIN32" /D "_CRT_SECURE_NO_DEPRECATE" /D "GC_NOT_DLL" /D "HAVE_CONFIG_H" /D "WINVER=0x0500" /D "_WIN32_WINNT=0x0500" /D "_WIN32_IE=0x0501" /D "WIN32_THREADS" /D "FD_SETSIZE=1024" /D "default_codegen" /D "MONO_ASSEMBLIES=0" /D "_UNICODE" /D "UNICODE" /GF /Gm- /EHsc /MT /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Fp".\Release/libmono.pch" /Fa"Win32\obj\libmono\" /Fo"Win32\obj\libmono\" /Fd"Win32\obj\libmono\vc100.pdb" /Gd /TC /analyze- /errorReport:queue
UPD:
I've found this discussion which is related to my question http://mono.1490590.n4.nabble.com/Mono-static-library-td3546774.html
Is it still actual? Can i use SGen instead of Boehm? If yes, any tip is very appreciated. And if yes, can i then use mono as a static library with use of sgen?
All is clear for me now.
Hans Passant gave an answer to Mysterious behavior of Dictionary<TKey, TSource> that shows that static linking won't work.
Answer to this question shows that there are no possibilities to choose another GC yet: Compiling Mono from Visual Studio with sgen support
Summarizing, it's understood that nowdays the only solution on windows is dynamic linking