[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Devel] shared library under Windows
From: |
Tor Lillqvist |
Subject: |
[Devel] shared library under Windows |
Date: |
Tue, 13 Mar 2001 21:42:49 +0200 (FLE Standard Time) |
Thierry Frey writes:
> Is there an easy way to build FT2 as a shared library under Windows ?
Not easy, but not hard either. I *had* to build freetype as a DLL,
otherwise the application didn't work for me. I can't remember the
details exactly, probably the problem was that if you have an .exe
linked to a static library, and a DLL also linked to the same static
library, these two library instances have separate copies of their
global variables. This causes strange problems, if the .exe code
passes data related to its copy of the library to the DLL which passes
it to its copy... With a DLL, there is only one copy of the library
and its global variables. How does Unix behave in cases like this?)
You have to modify the .mk files somewhat. I used the following
quickly hacked link_dll.mk file:
#
# Link instructions for building a DLL on Win32
#
# Copyright 1996-2000 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
ifdef BUILD_PROJECT
.PHONY: clean_project distclean_project
# Now include the main sub-makefile. It contains all the rules used to
# build the library with the previous variables defined.
#
include $(TOP)/builds/$(PROJECT).mk
PROJECT_VERSION := 2.0
PROJECT_LIBRARY_BASENAME := $(LIBRARY)-$(PROJECT_VERSION).dll
PROJECT_LIBRARY := $(LIB_)$(PROJECT_LIBRARY_BASENAME)
PROJECT_GCC_IMPORT_LIBRARY := lib$(LIBRARY)-$(PROJECT_VERSION).a
PROJECT_MSVC_IMPORT_LIBRARY := $(LIBRARY)-$(PROJECT_VERSION).lib
# The cleanup targets.
#
clean_project: clean_project_dos
distclean_project: distclean_project_dos
# This final rule is used to link all object files into a single library.
# this is compiler-specific
#
$(PROJECT_LIBRARY): $(OBJECTS_LIST)
ifdef CLEAN_LIBRARY
-$(CLEAN_LIBRARY) $(NO_OUTPUT)
endif
/src/glib/build-dll $(LIBRARY) $(PROJECT_VERSION)
$(TOP)/builds/$(LIBRARY).def $(OBJECTS_LIST)
mv $(PROJECT_LIBRARY_BASENAME) $(LIB_)
mv $(PROJECT_GCC_IMPORT_LIBRARY) $(LIB_)
mv $(PROJECT_MSVC_IMPORT_LIBRARY) $(LIB_)
endif
# EOF
Here is the freetype.def file I used:
EXPORTS
FTC_Image_Cache_Lookup
FTC_Image_Cache_New
FTC_Manager_Done
FTC_Manager_Lookup_Face
FTC_Manager_Lookup_Size
FTC_Manager_New
FTC_Manager_Reset
FT_Access_Frame
FT_Add64
FT_Add_Default_Modules
FT_Add_Module
FT_Alloc
FT_Attach_File
FT_Attach_Stream
FT_Create_Extensions
FT_Destroy_Extensions
FT_Div64by32
FT_DivFix
FT_Done_Extensions
FT_Done_Face
FT_Done_FreeType
FT_Done_Glyph
FT_Done_GlyphSlot
FT_Done_Library
FT_Done_Memory
FT_Done_Size
FT_Done_Stream
FT_Extract_Frame
FT_Forget_Frame
FT_Free
FT_Get_Char
FT_Get_Char_Index
FT_Get_Extension
FT_Get_Glyph
FT_Get_Glyph_Name
FT_Get_Kerning
FT_Get_Long
FT_Get_LongLE
FT_Get_Module
FT_Get_Module_Interface
FT_Get_Multi_Master
FT_Get_Offset
FT_Get_Renderer
FT_Get_Sfnt_Table
FT_Get_Short
FT_Get_ShortLE
FT_GlyphLoader_Add
FT_GlyphLoader_Check_Points
FT_GlyphLoader_Check_Subglyphs
FT_GlyphLoader_Copy_Points
FT_GlyphLoader_Create_Extra
FT_GlyphLoader_Done
FT_GlyphLoader_New
FT_GlyphLoader_Prepare
FT_GlyphLoader_Reset
FT_GlyphLoader_Rewind
FT_Glyph_Copy
FT_Glyph_Get_CBox
FT_Glyph_To_Bitmap
FT_Glyph_Transform
FT_Init_Extensions
FT_Init_FreeType
FT_List_Add
FT_List_Finalize
FT_List_Find
FT_List_Insert
FT_List_Iterate
FT_List_Remove
FT_List_Up
FT_Load_Char
FT_Load_Glyph
FT_Lookup_Renderer
FT_Lru_Done
FT_Lru_Lookup
FT_Lru_Lookup_Node
FT_Lru_New
FT_Lru_Remove_Node
FT_Lru_Remove_Selection
FT_Lru_Reset
FT_Matrix_Invert
FT_Matrix_Multiply
FT_MulDiv
FT_MulFix
FT_MulTo64
FT_New_Face
FT_New_GlyphSlot
FT_New_Library
FT_New_Memory
FT_New_Memory_Face
FT_New_Memory_Stream
FT_New_Size
FT_New_Stream
FT_Open_Face
FT_Outline_Copy
FT_Outline_Decompose
FT_Outline_Done
FT_Outline_Done_Internal
FT_Outline_Get_Bitmap
FT_Outline_Get_CBox
FT_Outline_New
FT_Outline_New_Internal
FT_Outline_Render
FT_Outline_Reverse
FT_Outline_Transform
FT_Outline_Translate
FT_Read_Char
FT_Read_Fields
FT_Read_Long
FT_Read_LongLE
FT_Read_Offset
FT_Read_Short
FT_Read_ShortLE
FT_Read_Stream
FT_Read_Stream_At
FT_Realloc
FT_Register_Extension
FT_Release_Frame
FT_Remove_Module
FT_Render_Glyph
FT_Render_Glyph_Internal
FT_Seek_Stream
FT_Select_Charmap
FT_Set_Char_Size
FT_Set_Charmap
FT_Set_Debug_Hook
FT_Set_MM_Blend_Coordinates
FT_Set_MM_Design_Coordinates
FT_Set_Pixel_Sizes
FT_Set_Renderer
FT_Set_Transform
FT_Skip_Stream
FT_Sqrt64
FT_Stream_Pos
FT_Vector_Transform
TT_New_Context
TT_RunIns
Hope this helps,
--tml