Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
693 views
in Technique[技术] by (71.8m points)

visual studio 2010 - Compiling FreeType to DLL (as opposed to static library)

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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 buildswin32vc2010 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 objswin32vc2010 directory.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...