• Advertisement

Archived

This topic is now archived and is closed to further replies.

Dlls - Please Help

This topic is 6383 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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);

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
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

Share this post


Link to post
Share on other sites
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);

Share this post


Link to post
Share on other sites

  • Advertisement