|
|
#1 |
|
Участник
|
при вызове функции из своей DLL, вылетает ошибка
Вот такая штука, что при вызове функции из своей DLL, вылетает данная ошибка
Цитата:
The value of the ESP register was not properly saved across the call to function 'PGP_SetExecutablePath' in DLL library 'pgp_gnupg.dll'. This is usually a result of calling a DLL function that has been declared with an incorrect number of arguments.
X++ Код: DLL dll = new DLL("pgp_gnupg.dll");
DLLFunction funcSetExecutablePath;
boolean b;
;
if (!dll)
throw error("No DLL found");
funcSetExecutablePath = new DLLFunction(dll, "PGP_SetExecutablePath");
if (!funcSetExecutablePath)
throw error("No function PGP_SetExecutablePath found");
funcSetExecutablePath.returns( ExtTypes::Byte );
funcSetExecutablePath.arg( ExtTypes::String );
b = funcSetExecutablePath.call( this.PGPParameters().DLL );Код: #define DLLEXPORT __declspec(dllexport)
DLLEXPORT bool PGP_SetExecutablePath(LPCSTR _fileName)
{
if (!g_ExecutablePath)
g_ExecutablePath = new char;
strcpy( g_ExecutablePath, _fileName );
return true;
}Код: DLL dll = new DLL("ax_testdll.dll");
DLLFunction f;
binary pArg = new Binary("qwerqwefasdf asdfa sd");
;
WinAPI::fileExists( "asdfas" ); // works fine!!!
f = new DLLFunction(dll, "fnAx_testdll" );
if (f)
{
f.returns( ExtTypes::void );
f.arg( ExtTypes::Pointer );
f.call(pArg);
}В чем проблема? Спасибо! |
|
|
|
|
#2 |
|
Гость
|
Последний раз редактировалось lagr221374; 07.03.2006 в 17:10. |
|
|
|
|
#3 |
|
Участник
|
если оставить только return true; в dll также валится?
|
|
|
|
|
#4 |
|
Участник
|
а что значит g_ExecutablePath = new char;
может g_ExecutablePath = new char[strlen(_fileName)]; |
|
|
|
|
#5 |
|
Участник
|
Цитата:
Сообщение от belugin
а что значит g_ExecutablePath = new char;
может g_ExecutablePath = new char[strlen(_fileName)]; `new char`, eto sozdajet pointer na odin char.. a dalse uze kak i svjazka char-char-char... (esli podajesh char *) |
|
|
|
|
#6 |
|
Участник
|
а как получается
strcpy( g_ExecutablePath, _fileName ); если под g_ExecutablePath выделен 1 char? и почему LPCSTR а не SZ? но это уже любопытство |
|
|
|
|
#7 |
|
Участник
|
может попробовать:
bool WINAPI _export PGP_SetExecutablePath(LPCSTR _fileName) мне кажется, что-то с соглашением о вызовах. |
|
|
|
|
#8 |
|
Участник
|
Цитата:
Сообщение от belugin
а как получается
strcpy( g_ExecutablePath, _fileName ); если под g_ExecutablePath выделен 1 char? и почему LPCSTR а не SZ? но это уже любопытство no soderzhimoe kopirujetsja...Problema ne v etom... ja uzhe proboval i s pustoj funkcijej... Na schet togo WINAPIm - ne poluchajetsja, tak kak v DLL bolse netu takoj f-ji (ona idet pod drugim nazvanijem "_PGP_SetExecutablePath@4" ) |
|
|
|
|
#9 |
|
Участник
|
ufff... reshil problemu
1.) postavil WINAPI pered deklaracijej funkcij 2.) sdelal my_dll.def fail Код: LIBRARY BTREE EXPORTS PGP_SetExecutablePath @1 PGP_EncryptFile @2 |
|
|
|
|
#10 |
|
Участник
|
>>a vot ne znaju no soderzhimoe kopirujetsja...
оно конечно копируется, но уверенны ли что не поверх чего-то важного a бы на вашем месте всё-таки сделал new char[strlen(_fileName)+1]; |
|
|