Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to load dll file in my VC++??

Status
Not open for further replies.

Bartec

Programmer
Jan 21, 2005
54
0
0
PL
Hi!

Actually I make program in VC++ and I need to load some function from dll file. I have only this dll file and nothing more. My dll file name is sche.dll and contain void showTr() method. I think I should try to load it dynamically and below is code I used:


//------------------------------------------------------------
Code:
HINSTANCE appInstance;

   appInstance = LoadLibrary("sche.dll");

			if(appInstance != NULL)
			{
				MessageBox("Got it!");
			
			}

				
  typedef void (__stdcall *showTrFn)();

  showTrFn pfnPokazOkno = (showTrFn)  GetProcAddress((HINSTANCE) appInstance, _T("showTr"));

ASSERT(pfnPokazOkno);//<---this is line I have run time  error
//-----------------------------------------------------

Compiler does not show any erorrs or warnings. So please help me find a bug. And one more thing dll is made in VB.

Thanks for any help

Cheers

Bartec





//------------------------------------------------------------

 
make sure your functions is actually exported from your dll!
declare as
__declspec(dllexport) void showTr();

You can verify by doing
dumpbin /EXPORTS sche.dll
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top