Access Violation when dynamically linking to nsldap32v50.dll
807573Jan 22 2002 — edited Jan 22 2002nsldap32v50.dll only works if client process (*.EXE file) statically links to nslad32v50.lib. If you write your own DLL that statically links to nslad32v50.lib, this DLL will crash when it calls ldap_simple_bind_s(), unless the host process also links to the LIB file. Of course, if you don't own the .EXE file for the host process (like MS IIS's dllhost.exe or inetinfo.exe), you're out of luck. Is there a fix to this that I should download? I assume nsldap32v50 is the latest version (nsldap32v50.dll doesn't have a version resource so I assume there is only one release for ver 5.0)
Theoretically, this test program should work but it doesn't:
<pre>
// main.cpp, simple test program
#include <windows.h>
int main()
{
typedef int(__stdcall ldap_init)(char, int);
typedef int(__stdcall ldap_bind_s)(int, char, char*, int);
HMODULE mod1 = LoadLibrary("nsldap32v50.dll");
ldap_init func_ldap_init = (ldap_init)GetProcAddress(mod1, "ldap_init");
ldap_bind_s func_ldap_bind_s = (ldap_bind_s)GetProcAddress(mod1, "ldap_bind_s");
int h = func_ldap_init("devsun6", 389);
int ret = func_ldap_bind_s(h, "cn=user,ou=userfil3,o=company", "", 128);
return 0;
}
</pre>