Access Violation错误
代码片段:ldap_set_option()函数报错
#include <winldap.h>
#pragma comment(lib,"WLDAP32.LIB")
LDAP *ld;
int version;
/* 打开一个连接 */
if ( (ld = ldap_open( "127.0.0.1", LDAP_PORT ))== NULL )
AfxMessageBox("open err");
version = LDAP_VERSION3;
//下面报错Unhandled exception in LDAP.EXE
//(wldap32.dll):0xc0000005:Access Violation
ldap_set_option(ld,LDAP_OPT_PROTOCOL_VERSION,&version);
/* 匿名登陆 */
if ( ldap_simple_bind_s( ld, NULL, NULL ) != LDAP_SUCCESS )
{
AfxMessageBox("bind err");
}