[Date Prev][Date Next] [Chronological] [Thread] [Top]

(ITS#7854) minor patches to allow compile with VS2012

Full_Name: Louis Solomon
Version: 2.4.39
OS: Win32 & Win64
Submission from: (NULL) (

in libraries/libldap/ldif.c move int ldif_debug = 0; to after _all_ the
includes. Why? because the linker gets confused with it being declared as
declspec(dllexport). Order matters.

in include/ac/socket.h EWOULDBLOCK, EINPROGRESS, ETIMEDOUT (lines 101-103)
conflict with the windows header files.  simply wrap with any rational choice of

in include/ldap_utf8.h wrap prototypes for ldap_x_utf8_to_wc (line 61) through
to ldap_x_mbs_utf8s (line 99) with #if SIZEOF_WCHAR>=4 to match the ifdef at the
top of utf-8-conv.c.  Why?  because the linker tries to export them as they are
defined in the header with declspec(dllexport) but are not in any .o/.obj

in include/ldap_cdefs.h the usage of __declspec(dllexport/dllimport) is not
quite right ... should be like

#if defined(_WIN32) 
#	define LDAP_F(type)		__declspec(dllimport) type
#	define LDAP_V(type)		extern __declspec(dllimport) type
#	define LDAP_F(type)		__declspec(dllexport) type
#	define LDAP_V(type)		extern __declspec(dllexport) type

and of course the same for each of the other sets (LBER, LDAP, LDAP_AVL,

With the above patches and making the appropriate .h files from .hin files
manually and then creating VS2012 project files, I was successfully able to
create and use liblber, libldap, libldap_r as .dlls