将 FreeType 编译为 DLL(相对于静态库) [英] Compiling FreeType to DLL (as opposed to static library)

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

问题描述

我想在 c# 项目中使用 FreeType.我发现这个绑定,但我仍然需要一个freetype.dll.我通常在我的 c++ 项目中使用静态库,所以我从来没有编译过.打开 freetype-solution (VS2010) 我注意到没有动态库的配置——只有静态库.我尝试进行自己的配置并让它生成一个 freetype.dll.如果我将它与 c#-binding 一起使用,我会得到一个异常,即未找到 FT_Init_FreeType 入口点.知道我必须如何调整 freetype-project 才能导出这些功能吗?

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?

推荐答案

如果你对旧版本(2008 年 3 月)没问题,你可以去 FreeType for Windows 页面,下载最新的 Binaries 包,打开 .ZIP,然后从 bin 目录中提取 FreeType6.dll.只需适当地重命名即可.

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:

打开 Visual Studio 2010,并从 buildswin32vc2010 目录加载 freetype.sln.

open Visual Studio 2010, and load freetype.sln from the buildswin32vc2010 directory.

打开项目配置,在General选项卡中,将Configuration Type改为Dynamic Library (.dll)

open the project config, and in the General tab, change Configuration Type to Dynamic Library (.dll)

打开 ftoption.h 文件,并添加以下几行(例如在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

  • 将项目编译配置更改为Release".

  • change the project compilation configuration to "Release".

    编译项目.您现在应该在 objswin32vc2010 目录中有一个 freetype246.dll.

    compile the project. You should now have a freetype246.dll in the objswin32vc2010 directory.

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

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