将单声道作为静态库 [英] Compilling mono as static library

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

问题描述

我想在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

我已经做了。

下载单声道2.10.8源。

2)从msvc文件夹打开mono.sln并确保一切正在编译。

3)然后我做了一些更改:

3.1)General-> Project Defaults->配置类型:静态库(.lib)

3.2)General-> Project Defaults->使用MFC:使用标准Windows库

3.3)C / C ++ - >代码生成 - >运行时库:多线程(/ MT)

4)构建它和VC ++ 2010成功创建mono-2.0.lib

5)在我自己的项目(我想嵌入单声道)的链接器输入中添加它:

5.1)General-> Project Defaults-> Configuration Type:Application(.exe)

5.2)General-> Project Defaults->使用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- / DNDEBUG/ D i386 / D
TARGET_X86/ Di386/ DWIN32/ D_WIN32/ D WIN32 / D
_WINDOWS/ DWINDOWS/ DHOST_WIN32 / DTARGET_WIN32/ D
_CRT_SECURE_NO_DEPRECATE/ DGC_NOT_DLL/ DHAVE_CONFIG_H/ D
WINVER = 0x0500/ D_WIN32_WINNT = 0x0500/ D_WIN32_IE = 0x0501 / D
WIN32_THREADS/ DFD_SETSIZE = 1024/ D default_codegen / D
MONO_ASSEMBLIES = 0/ D_UNICODE/ DUNICODE GF / Gm- / EHsc / MT / GS
/ Gy / fp:precise / Zc:wchar_t / Zc:forScope /Fp\".\Release/libmono.pch
/ FaWin32 \\ obj \libmono \/ FoWin32 \obj\libmono\
/Fd\"Win32\obj\libmono\vc100.pdb/ Gd / TC / analyze- / errorReport:队列

/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

ve找到了与我的问题相关的讨论 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?

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?

推荐答案

对我来说。

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的可能性:
从Visual Studio编译单声道与sgen支持

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

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

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