[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
OpenLDAP C Client Libraries
I've managed to successfully build the OpenLDAP C client libraries using
Microsoft Visual C++ 7, including libldap, libldap_r, liblber, and TLS
support via Cyrus SASL. It was not an easy task however...the Visual Studio
solution in the build directory really needs to be updated. I did not find
much documentation on building the client libraries by themselves, but I did
read the "Porting to Microsoft Visual C++ for Windows NT/2000" FAQ located
at http://www.openldap.org/faq/data/cache/99.html, which helped somewhat. I
also read a very insightful post by Jon Leichter back in December 2001,
located at
http://www.openldap.org/lists/openldap-devel/200112/msg00133.html.
Building of the libraries was actually not very difficult, but what threw me
off was that the dlls I compiled did not export any of their function
definitions. Thus, I began researching how best to get the build to export
these definitions. There's a comment in ldap_cdefs.h in the include
directory (lines 98-101) that states:
"Note that we don't actually have to worry about using the
__declspec(dllexport) directive anywhere. This is because both MSVC and
Mingw provide alternate (more effective) methods for exporting symbols out
of binaries, i.e. the use of a DEF file."
In reading that comment, I expected to find a DEF file in the OpenLDAP
source, but I could not locate one. And, as the above comment states,
__declspec(dllexport) is not being used anywhere. What I'd like to know is
the best route to take to have the dlls export the appropriate function
definitions. The method I used to get it to work is a hack...I modified the
following lines in ldap_cdefs.h and then compiled.
Lines 130-131:
Original:
# define LBER_F(type) extern __declspec(dllimport) type
# define LBER_V(type) extern __declspec(dllimport) type
Modified:
# define LBER_F(type) extern __declspec(dllexport) type
# define LBER_V(type) extern __declspec(dllexport) type
Lines 141-142:
Original:
# define LDAP_F(type) extern __declspec(dllimport) type
# define LDAP_V(type) extern __declspec(dllimport) type
Modified:
# define LDAP_F(type) extern __declspec(dllexport) type
# define LDAP_V(type) extern __declspec(dllexport) type
I don't know how good a solution this is to getting the appropriate function
definitions exported in liblber and libldap...does anyone have any
suggestions on a better method? Any comments or suggestions would surely be
appreciated.
Thanks,
Jason