Dynamisches einbinden einer DLL



  • Hallo,

    ich habe folgendes Problem beim dynamischen Linken einer Libary:
    Die Funktion wird ausgeführ und danach kommt die Fehlermeldung:
    "The value of ESP was not properly saved across a function call"....
    Ich bin jetzt schon sechsmal alles durchgegangen, aber ich finde den Fehler nicht. Könnt ihr mir bitte helfen??

    Header-Datei //common.h"

    typedef unsigned long 	Dword;                                /* Dword as unsigned long				*/
    
    typedef struct {
    	int			iNumOfBurner;
    	char		cDescription[10][64];
    	char		cDriveLetter[10][2];
    }R_DEVICE;
    //Prototypen
    
    void vGetDevices(R_DEVICE *ptDevice, Dword *dwAnswer);
    

    Def.Datei

    LIBRARY   owndevice
    HEAPSIZE 1024
    
    EXPORTS
    vBurnFiles	@1
    vGetDevices	@2
    

    Test-Programm

    #include <windows.h>
    #include "common.h"			
    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
    {
    	FARPROC lpfnzDevices;
    	HANDLE hLibHandle;
    	R_DEVICE tDevice={0};
    	Dword dwAnser;
    
    	hLibHandle=LoadLibrary("OwnDevice.dll");
    	if (hLibHandle < (HANDLE)32)
    	{
    		return -1;
    	}
    	else
    	{
    		lpfnzDevices=GetProcAddress(hLibHandle, "vGetDevices");
    		(*lpfnzDevices)(&tDevice, &dwAnser);
    		FreeLibrary(hLibHandle);
    	}
    
    	return 0;
    }
    

    Ich verwende VC++ 6.0 auf einer Windows XP Umgebung.
    Gruß Damion



  • Das hat was mit der Calling Convention zu tun. Benutz mal __stdcall


Anmelden zum Antworten