Click here to Skip to main content
15,919,931 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: sending keystrokes to window Pin
vins27-Mar-02 8:16
vins27-Mar-02 8:16 
QuestionHow do I determine what functions a dll are exporting? Pin
Tommy Svensson27-Mar-02 5:03
Tommy Svensson27-Mar-02 5:03 
AnswerRe: How do I determine what functions a dll are exporting? Pin
Chris Losinger27-Mar-02 5:27
professionalChris Losinger27-Mar-02 5:27 
GeneralRe: How do I determine what functions a dll are exporting? Pin
Tommy Svensson27-Mar-02 6:08
Tommy Svensson27-Mar-02 6:08 
AnswerRe: How do I determine what functions a dll are exporting? Pin
Paul M Watt27-Mar-02 5:48
mentorPaul M Watt27-Mar-02 5:48 
GeneralRe: How do I determine what functions a dll are exporting? Pin
Tommy Svensson27-Mar-02 6:16
Tommy Svensson27-Mar-02 6:16 
GeneralRe: How do I determine what functions a dll are exporting? Pin
Tommy Svensson27-Mar-02 6:36
Tommy Svensson27-Mar-02 6:36 
GeneralRe: How do I determine what functions a dll are exporting? Pin
Paul M Watt27-Mar-02 9:03
mentorPaul M Watt27-Mar-02 9:03 
I am sorry, this is the correct declaration for the function pointer. Typedef it so that you can use it later.

typedef int(*fnDllTestPtr)(void);

Also, if you do not encapsulate the function that you are exporting with extern "c"{ }, then the function will be name mangled, and you will have to include the mangled name in order to load it. So for the function that you have sent in, it should be managled like this:

?fnDllTest@@YAHXZ

Before you attempt to call the function, you should check the return value from GetProcAddress to insure that the function was found and properly pointed to. If the function fails, it will return NULL.

Here is the code that you should use.

typedef int(*fnDllTestPtr)(void);
fnDllTestPtr fp = (fnDllTestPtr)::GetProcAddress(libPtr, "?fnDllTest@@YAHXZ");
if (NULL == fp)
{
MessageBox(NULL, "an error has occurred. The function did not load.", "error", MB_OK);
}
else
{
int i = fp();
}



GeneralRe: How do I determine what functions a dll are exporting? Pin
Tommy Svensson1-Apr-02 21:49
Tommy Svensson1-Apr-02 21:49 
GeneralRe: How do I determine what functions a dll are exporting? Pin
Tomasz Sowinski27-Mar-02 10:24
Tomasz Sowinski27-Mar-02 10:24 
AnswerRe: How do I determine what functions a dll are exporting? Pin
JT Anderson27-Mar-02 6:04
JT Anderson27-Mar-02 6:04 
AnswerRe: How do I determine what functions a dll are exporting? Pin
sanjay mishra2-Apr-02 0:35
sanjay mishra2-Apr-02 0:35 
GeneralCOleVariant's and globally unique ID's Pin
funbag27-Mar-02 4:40
funbag27-Mar-02 4:40 
GeneralRetrieve pointer of the view into Mainframe Pin
27-Mar-02 4:20
suss27-Mar-02 4:20 
GeneralRe: Retrieve pointer of the view into Mainframe Pin
Mazdak27-Mar-02 7:01
Mazdak27-Mar-02 7:01 
GeneralRe: Retrieve pointer of the view into Mainframe Pin
Mazdak27-Mar-02 7:02
Mazdak27-Mar-02 7:02 
GeneralProfiling - weird problem. Pin
Alex Deem27-Mar-02 4:11
Alex Deem27-Mar-02 4:11 
GeneralRe: Profiling - weird problem. Pin
moliate27-Mar-02 9:05
moliate27-Mar-02 9:05 
GeneralStatus Bar Text Limit Pin
27-Mar-02 3:43
suss27-Mar-02 3:43 
GeneralRe: Status Bar Text Limit Pin
Tomasz Sowinski27-Mar-02 4:12
Tomasz Sowinski27-Mar-02 4:12 
GeneralDialog question Pin
Rickard Andersson2027-Mar-02 3:38
Rickard Andersson2027-Mar-02 3:38 
GeneralRe: Dialog question Pin
Paul M Watt27-Mar-02 3:50
mentorPaul M Watt27-Mar-02 3:50 
GeneralRe: Dialog question Pin
Tomasz Sowinski27-Mar-02 3:47
Tomasz Sowinski27-Mar-02 3:47 
GeneralRe: Dialog question Pin
Michael P Butler27-Mar-02 3:54
Michael P Butler27-Mar-02 3:54 
Generalfatal error LNK1168: cannot open x.dll for writing Pin
albean27-Mar-02 3:33
albean27-Mar-02 3:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.