将FreeType编译为DLL(而不是静态库) [英] Compiling FreeType to DLL (as opposed to static library)

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

问题描述

我想在c#项目中使用FreeType。我发现此绑定,但我仍然需要一个freetype.dll。我通常在我的c ++项目中使用一个静态库,所以我从来没有编译过。打开freetype解决方案(VS2010)我注意到没有动态库的配置 - 只是静态库。我试图做我自己的配置,并得到它生成一个freetype.dll。如果我使用它与c#-binding我得到一个异常,没有找到FT_Init_FreeType入口点。任何想法如何我必须调整freetype项目以导出这些功能?

解决方案

版本(2008年3月),可以转到适用于Windows的FreeType 页面,下载最新的Binaries软件包,打开。 ZIP,并从bin目录解压FreeType6.dll。



如果您需要更新的版本,请按照以下步骤编译最新版本:




  • 下载最新的源代码(今天为2.4.6) //sourceforge.net/projects/freetype/files/freetype2/


  • 打开Visual Studio 2010,并加载 freetype


  • >打开项目配置,并在 General 选项卡中将配置类型更改为 (.dll)


  • 打开 ftoption.h 添加这些行(例如在DLL export compilation注释部分附近):



    #define FT_EXPORT(x)__declspec(dllexport)x



    #define FT_BASE(x)__declspec(dllexport)x


  • 将项目编译配置更改为 >


  • 编译项目。您现在应该在 objs \win32\vc2010 目录中有 freetype246.dll

    / li>

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 the builds\win32\vc2010 directory.

  • open the project config, and in the General tab, change Configuration Type to Dynamic 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 the objs\win32\vc2010 directory.

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

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