Dlls - Please Help
First off let me explain something: My old computer with all my programming stuff went "kerplop";
When I went to install it on my new computer, I couldn''t find my VC++ 6 cd, all I could find was Borland 4.5.
now on to question:
How do you properly export/inport a function using BC++?
I tried the Using Interfaces with DLLs tutorial, but no go: the compiler gives some error like:
Link Error! Attempting to export non-public symbol ''symbolName''
(where symbolName is the name of the function in in the DEF file
and you can''t use __declspec(dllexport) it is not supported.
I tried using Borland''s _export keyword, but I still can''t load it with GetProcAddress()
Any suggestions?
-Mr. Goodbytes
Programming in Binary -as easy as 00 01 11
C spot;
CSpot run;
Run(spot, run);
Programming in Binary -as easy as 00 01 11C spot;CSpot run;Run(spot, run);
September 03, 2000 12:54 AM
I don''t think I''d able to answer your question, but I did have a question about your post:
Are you trying to load the DLL staticly or dynamicly?
-PocketProtector
I mean
-PocketHolster
Are you trying to load the DLL staticly or dynamicly?
-PocketProtector
I mean
-PocketHolster
Oh, sorry;
I''m loading it dynamicaly;
I got it to load the dll correctly using LoadLibrary and all,
but GetProcAddress() won''t return the pointer to my function;
Here''s some source code:
// Declare function
int MyFunction (int param);
...
int MyFunction (int param) {
... // Do Stuff
}
//======================================
//and int the exe
extern "C" int MyFunction(int param);
typedef int (*MyFunc)(int param);
///...
MyFunc pfnMyFunc=0;
HINSTANCE hMyDll = ::LoadLibrary("mydll.dll");
if (hMyDll != NULL)
{
pfnMyFunc = (MyFunc)::GetProcAddress(hMyDll, "MyFunction");
if (pfnMyFunc == 0)
{
cout << "GetProcAddress failed...\n";
::FreeLibrary(hMyDll);
return CANT_LOAD_DLL;
}
result = pfnMyFunc(14);
::FreeLibrary(hMyDll);
}
Any clues/suggestions?
Programming in Binary -as easy as 00 01 11
C spot;
CSpot run;
Run(spot, run);
I''m loading it dynamicaly;
I got it to load the dll correctly using LoadLibrary and all,
but GetProcAddress() won''t return the pointer to my function;
Here''s some source code:
// Declare function
int MyFunction (int param);
...
int MyFunction (int param) {
... // Do Stuff
}
//======================================
//and int the exe
extern "C" int MyFunction(int param);
typedef int (*MyFunc)(int param);
///...
MyFunc pfnMyFunc=0;
HINSTANCE hMyDll = ::LoadLibrary("mydll.dll");
if (hMyDll != NULL)
{
pfnMyFunc = (MyFunc)::GetProcAddress(hMyDll, "MyFunction");
if (pfnMyFunc == 0)
{
cout << "GetProcAddress failed...\n";
::FreeLibrary(hMyDll);
return CANT_LOAD_DLL;
}
result = pfnMyFunc(14);
::FreeLibrary(hMyDll);
}
Any clues/suggestions?
Programming in Binary -as easy as 00 01 11
C spot;
CSpot run;
Run(spot, run);
Programming in Binary -as easy as 00 01 11C spot;CSpot run;Run(spot, run);
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement