Howdy, Stranger!

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

Categories

Turbo C++ dynamic dll call problem

KjekliKjekli Member Posts: 1
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

  • LundinLundin Member Posts: 3,711
    : 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.