将Mono编译为静态库 [英] Compiling mono as static library

查看:234
本文介绍了将Mono编译为静态库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Windows上将libmono编译为静态库.

I want to compile libmono as static library at Windows.

目标平台是Windows x86.构建环境:Windows 7 64位,VC ++ Express 2010

Target platform is Windows x86. Build environment: Windows 7 64-bit, VC++ Express 2010

我已经做了.

1)下载了mono 2.10.8来源.
2)从msvc文件夹中打开mono.sln,并确保所有内容都已编译.
3)然后我做了一些更改:
3.1)常规->项目默认设置->配置类型:静态库(.lib)
3.2)常规->项目默认设置-> MFC的使用:使用标准Windows库
3.3)C/C ++->代码生成->运行时库:多线程(/MT)
4)构建它,并且VC ++ 2010成功创建了mono-2.0.lib
5)使用以下命令将其添加到我自己的项目的链接器输入中(我想将其嵌入到其中):
5.1)常规->项目默认值->配置类型:应用程序(.exe)
5.2)常规->项目默认设置-> MFC的使用:在Ststic库中使用MFC
5.3)C/C ++->代码生成->运行时库:多线程(/MT)

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)

它似乎接近完美,但存在一些可怕的问题: Dictionary< TKey, TSource>

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?

PS: libmono命令行为:

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

/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:

我找到了与我的问题有关的讨论 http://mono.1490590.n4.nabble.com/Mono-static-library-td3546774.html

I've found this discussion which is related to my question http://mono.1490590.n4.nabble.com/Mono-static-library-td3546774.html

它仍然是实际的吗? 我可以使用SGen代替Boehm吗?如果是,则非常感谢您提供任何建议. 如果是的话,我可以使用sgen将mono用作静态库吗?

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回答了 Dictionary< TKey,TSource> 的神秘行为这表明静态链接将无法正常工作.

Hans Passant gave an answer to Mysterious behavior of Dictionary<TKey, TSource> that shows that static linking won't work.

该问题的答案表明,尚无选择其他GC的可能性: 使用sgen支持从Visual Studio编译Mono

Answer to this question shows that there are no possibilities to choose another GC yet: Compiling Mono from Visual Studio with sgen support

总结一下,可以理解,当今Windows上唯一的解决方案是动态链接

Summarizing, it's understood that nowdays the only solution on windows is dynamic linking

这篇关于将Mono编译为静态库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆