【初心者歓迎】C/C++室 Ver.26【環境依存OK】
■ このスレッドは過去ログ倉庫に格納されています
0323デフォルトの名無しさん
2006/04/10(月) 01:42:23下の、MessageBox(hDlg,DLL_buf,"Success!", MB_ICONWARNING);の部分と、終了時に
Run-Time Check Failure #0 - 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.
とエラーが出ます。
強行するとちゃんと動作するんですけど…いまいちどこら辺がマズいのかがわからないです。
DLL部分
LPTSTR WINAPI ReturnString(int i, LPTSTR str){
_stprintf(str, "%d", i);
lstrcmp(str, "が入力されました。");
return str;
}
読み込み側
typedef LPTSTR (*TFUNC)(int, LPTSTR);
〜中略
HINSTANCE hDLL;
TFUNC fncDLL01;
TCHAR DLL_buf[128];
if( !(hDLL = LoadLibrary("CE60_def.dll")) ){
MessageBox(hDlg,"ERROR!\nDLLが見つからない。","エラー", MB_ICONWARNING);
}else if( !(fncDLL01 = (TFUNC)GetProcAddress(hDLL, "ReturnString")) ){
FreeLibrary(hDLL);
MessageBox(hDlg,"ERROR!\n関数が見つからない。","エラー", MB_ICONWARNING);
}else{
fncDLL01(10,DLL_buf);
MessageBox(hDlg,DLL_buf,"Success!", MB_ICONWARNING);
FreeLibrary(hDLL);
以下略
■ このスレッドは過去ログ倉庫に格納されています