freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Devel] Win32 library does not work in VC++ 6.0


From: Vincent Caron
Subject: RE: [Devel] Win32 library does not work in VC++ 6.0
Date: 24 Jul 2002 11:34:55 +0200

On Wed, 2002-07-24 at 09:53, Graham Asher wrote:
> 
> #define FT_EXPORT(return_type) __declspec(dllexport) return_type
> #define FT_EXPORT_DEF(return_type) __declspec(dllexport) return_type
> 
> I don't guarantee this will work for an ordinary statically linked library,
> but it certainly works for a DLL.

This is actually the way to go. The alternative is to explicitely list
the symbols to be exported in a .DEF file, but it tends to be out of
sync with the implementation.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/html/_core_export_from_a_dll.asp

Note that the DLL user should include FreeType's header with the same
macros using __declspec(dllimport). Quoting MSDN again :

"You do not need to use __declspec(dllimport) for your code to compile
correctly, but doing so allows the compiler to generate better code. The
compiler is able to generate better code because it knows for sure
whether a function exists in a DLL or not, so the compiler can produce
code that skips a level of indirection that would normally be present in
a function call that crossed a DLL boundary. However, you must use
__declspec(dllimport) in order to import variables used in a DLL."

Since FreeType does not define (global) variables, you're safe anyway.
And IMHO their so-called optimisation is plainly stupid, I guess it
invokes a relocation table at DLL loadtime (smells like DOS), and
prevents you from using lazy binding (symbol lookup on usage). Welcome
to the 'DLL Hell' :

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsetup/html/dlldanger1.asp






reply via email to

[Prev in Thread] Current Thread [Next in Thread]