DLLs Funktionen mit Parametern...



  • Hallo !
    Ich habe ein Problem...
    Ich kann zwar Funktionen aus eigenen DLLs aufrufen, allerdings bekomme ich folgende Fehlermeldung wenn ich versuche das ganze System mit Parametern/rückgabewerten laufen zulassen...
    **Module:
    i386\chkesp.c
    Line:42
    The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.
    **
    Wenn ich das ganze Project schritt für schritt durchlaufen lasse bekomme ich diesen fehler nachdem die Funktion in der DLL ausgeführt wurde und der Wert der DLLfunktion schon zurückgegeben wurde ( die variable im programm selbst allerdings wird damit nie gefüllt weil ja vorher der fehler kommt...)

    die relevanten Abschnitte meines Programms sehen folgendermaßen aus

    #include "dllversion.h"
    CTSPlugins::p_CheckIfUsefull()
    {
    	bool no_errors=true;
    	CString location =  p_GetCurrentPlugin()->p_GetFileLocation();
    	HINSTANCE hLib;
    
    	GETNAME lpfGetName = NULL;
    	INITPLUGIN lpfInitPlugin = NULL;
    
    	CString p_Name;
    	int i=0;
    // getprocaddresses ist von http://www.codeproject.com
    	if(GetProcAddresses( &hLib,location, 2,
            &lpfInitPlugin, "InitPlugIn",
    		&lpfGetName, "GetName"))
        {
            lpfInitPlugin();
    		i=lpfGetName(NULL,"test","",0);
    
        }else
    		no_errors = false;
    //sonstige geschichten
    
    //typendefinition (dllversion.h)
    typedef int ( WINAPI *GETNAME ) 
        ( HWND , LPCSTR, LPCSTR, DWORD);
    
    //dll
    #define PLUG_API __declspec (dllexport)
    extern "C" PLUG_API int GetName(HWND , LPCSTR, LPCSTR, DWORD);
    PLUG_API int GetName(HWND hwnd, LPCSTR text, LPCSTR title, DWORD type)
    {
    	AFX_MANAGE_STATE(AfxGetStaticModuleState());
    	int i=0;
    	i = MessageBox(hwnd,text,title,type);
    	return i;
    }
    

    ich fänds klasse wenn mir mal jemand sagen könnte was ich nap mal wieder falsch mache .... 🙂


Anmelden zum Antworten