freetype의 dll 컴파일

7466 단어 type
python에freetype 라이브러리를 사용해야 하기 때문에 so에는freetype dll가 필요합니다
2 steps
1. VC에서 출력을 동적 링크 라이브러리로 설정
2. ftoption을 수정합니다.h
284줄에 2줄 코드를 추가하면 됩니다.
  /*************************************************************************/

  /*                                                                       */

  /* DLL export compilation                                                */

  /*                                                                       */

  /*   When compiling FreeType as a DLL, some systems/compilers need a     */

  /*   special keyword in front OR after the return type of function       */

  /*   declarations.                                                       */

  /*                                                                       */

  /*   Two macros are used within the FreeType source code to define       */

  /*   exported library functions: FT_EXPORT and FT_EXPORT_DEF.            */

  /*                                                                       */

  /*     FT_EXPORT( return_type )                                          */

  /*                                                                       */

  /*       is used in a function declaration, as in                        */

  /*                                                                       */

  /*         FT_EXPORT( FT_Error )                                         */

  /*         FT_Init_FreeType( FT_Library*  alibrary );                    */

  /*                                                                       */

  /*                                                                       */

  /*     FT_EXPORT_DEF( return_type )                                      */

  /*                                                                       */

  /*       is used in a function definition, as in                         */

  /*                                                                       */

  /*         FT_EXPORT_DEF( FT_Error )                                     */

  /*         FT_Init_FreeType( FT_Library*  alibrary )                     */

  /*         {                                                             */

  /*           ... some code ...                                           */

  /*           return FT_Err_Ok;                                           */

  /*         }                                                             */

  /*                                                                       */

  /*   You can provide your own implementation of FT_EXPORT and            */

  /*   FT_EXPORT_DEF here if you want.  If you leave them undefined, they  */

  /*   will be later automatically defined as `extern return_type' to      */

  /*   allow normal compilation.                                           */

  /*                                                                       */

  /*   Do not #undef these macros here since the build system might define */

  /*   them for certain configurations only.                               */

  /*                                                                       */

/* #define FT_EXPORT(x)      extern x */

/* #define FT_EXPORT_DEF(x)  x */

#define FT_EXPORT(x) __declspec(dllexport) x

#define FT_BASE(x) __declspec(dllexport) x

 
 
또한 생성된 dll는phthon에 직접 넣습니다.exe가 있는 디렉터리는 시스템 32에 넣을 필요가 없습니다.

좋은 웹페이지 즐겨찾기