|
-
October 26th, 2010, 02:19 AM
#1
how to interlink the dlls
hi all,
I am working on a project whose configuration type is dll and i have one more dll whose function i have to invoke in my project so i want to know that is this possible to interlink the dlls?
Because i am getting problem to invoke the function of the dll in my project.
thanks ,
rohit negi
-
October 26th, 2010, 06:59 AM
#2
Re: how to interlink the dlls
1. Which compiler are you using?
2. Which problems do you get?
Cheers, D Drmmr
Please put [code][/code] tags around your code to preserve indentation and make it more readable.
As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky
-
October 27th, 2010, 02:10 AM
#3
Re: how to interlink the dlls
hi all,
sorry for wrong place for post actually I am using vs2008. when the try to initialize it gives run time error at the line AccID=m_accreg(sip,sip,"*",user,pwd,NULL,TRUE);
Code:
void CAdoreDemoEventSink::InitializeDll()
{
USES_CONVERSION;
CString str,targetpath;
TCHAR pathvalue[100];
ULONG length=127;
DWORD tamano = GetCurrentDirectoryW(0, NULL);
int liblen=11;
CString strDirectory,lib;
LPWSTR buffer = new WCHAR[tamano + liblen];
tamano = GetCurrentDirectoryW(tamano, buffer);
lstrcatW(buffer, lib);
strDirectory=(CString)buffer;
targetpath=strDirectory;
// AfxMessageBox(targetpath);
targetpath=targetpath + L"\\AdoreSoftPhone.dll";
targetpath.Replace(L"\\",L"\\\\");
hDLL = LoadLibrary(targetpath);
if (hDLL)
{
dll_init m_dllinit;
m_dllinit = (dll_init)GetProcAddress(hDLL,"dll_init");
if(m_dllinit)
{
m_dllinit();
dll_main m_dllmain;
m_dllmain = (dll_main)GetProcAddress(hDLL,"dll_main");
m_dllmain();
}
else
{
MessageBox(NULL,_T("Unable to Load DLL") ,_T("UnableDll"),MB_OK);
FreeLibrary(hDLL);
return;
}
}
dll_AccReg m_accreg;
m_accreg = (dll_AccReg)GetProcAddress(hDLL,"dll_registerAccount");
char *sip,*user,*pwd,*stcheck;
CString username = L"72815";
CString password = L"72815";
CString strsip=L"sip:"+username+L"@"+L"67.212.81.164";
sip=OLE2A(strsip);
user = OLE2A(username);
pwd = OLE2A(password);
MessageBox(NULL,targetpath,_T("before account reg"),MB_OK);
AccID=m_accreg(sip,sip,"*",user,pwd,NULL,TRUE);//this line gives runtime error
MessageBox(NULL,targetpath,_T("after account reg"),MB_OK);
}
It is a web application .
-
October 27th, 2010, 03:43 AM
#4
Re: how to interlink the dlls
 Originally Posted by rohitnegi
sorry for wrong place for post actually I am using vs2008. when the try to initialize it gives run time error at the line AccID=m_accreg(sip,sip,"*",user,pwd,NULL,TRUE);
You are not checking if GetProcAddress returns a valid address. You do for dll_init, but not for the other functions.
Then you also have to check whether the function signature matches exactly with what you cast it to.
And finally, you need to check that you are passing valid arguments to the function. Without knowing more about that function, I can't provide more help.
Cheers, D Drmmr
Please put [code][/code] tags around your code to preserve indentation and make it more readable.
As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|