问题描述
我想在c#项目中使用FreeType。我发现这个,但我仍然需要一个freetype.dll。我通常在我的c ++项目中使用一个静态库,所以我从来没有编译过一个。打开freetype解决方案(VS2010)我注意到没有动态库的配置 - 只是静态库。我试图做自己的配置,并得到它来生成一个freetype.dll。如果我使用它与c#-binding我得到一个例外,没有找到FT_Init_FreeType入口点。任何想法我如何调整freetype项目以导出这些功能?如果你没有旧的版本(2008年3月),您可以转到页面,下载最新的Binaries软件包,打开。 ZIP,并从bin目录中提取FreeType6.dll。只需重新命名它。
如果您需要更新版本,可以编辑最新版本:
-
从
-
打开Visual Studio 2010,加载
freetype来自
builds\win32\vc2010
目录中的.sln -
打开项目配置,并在
常规
选项卡中,将配置类型
更改为动态库(.dll)
-
打开
ftoption.h
文件,添加这些行(例如在DLL导出编译备注部分附近):
#define FT_EXPORT(x)__declspec(dllexport)x
#define FT_BASE(x)__declspec(dllexport)x
-
将项目编译配置更改为Release。 >
-
编译项目。您现在应该在
/ li>objs\win32\vc2010
目录中有一个freetype246.dll
。
I want to use FreeType in a c# project. I found this binding, but I still need a freetype.dll. I usually use a static library in my c++ projects, so I never compiled one. Opening the freetype-solution (VS2010) I noticed that there is no configuration for a dynamic library - just static ones. I tried to make my own configuration and got it to generate a freetype.dll. If I use it with the c#-binding I get an exception, that the FT_Init_FreeType-entry point was not found. Any idea how I must adjust the freetype-project in order to export those functions?
If you're ok with an old version (march 2008), you can go to FreeType for Windows page, download the latest Binaries package, open the .ZIP, and extract FreeType6.dll from the bin directory. Just rename it appropriately.
If you need a more recent version, here is how you can compile the latest:
download the latest source (2.4.6 as of today) from http://sourceforge.net/projects/freetype/files/freetype2/
open Visual Studio 2010, and load
freetype.sln
from thebuilds\win32\vc2010
directory.open the project config, and in the
General
tab, changeConfiguration Type
toDynamic Library (.dll)
open the
ftoption.h
file, and add these lines (near the "DLL export compilation" remarks section for example):#define FT_EXPORT(x) __declspec(dllexport) x
#define FT_BASE(x) __declspec(dllexport) x
change the project compilation configuration to "Release".
compile the project. You should now have a
freetype246.dll
in theobjs\win32\vc2010
directory.
这篇关于将FreeType编译为DLL(而不是静态库)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!