Turbo C++ dynamic dll call problem

hi I've tried to use dll trough loadlibrary() function, do anybody know how to p***s of "nonfunction call" error? It came when I use the pointer to function in memory. my verion is:
10.0.2288.42451 Update 2

here is problematic code segment:

HINSTANCE USB= LoadLibraryA("SiUSBXp.dll");
typedef SI_STATUS (WINAPI * pNumDev)(LPDWORD);
pNumDev * pGetNumDevices;

unsigned long a; SI_STATUS S;

pGetNumDevices=(pNumDev *)GetProcAddress(USB,"SI_GetNumDevices");
if (USB==NULL) { Label7->Caption="fail"; return;}
else Label7->Caption="ok";

if (pGetNumDevices!=NULL)
{
pGetNumDevices(&a); //<- here is the problem
Label7->Caption=IntToStr(a);
}

Comments

  • : HINSTANCE USB= LoadLibraryA("SiUSBXp.dll");
    : typedef SI_STATUS (WINAPI * pNumDev)(LPDWORD);
    : pNumDev * pGetNumDevices;

    This should be

    pNumDev pGetNumDevices;

    You want a function pointer, not a pointer to a function pointer.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion