大学の研究でとあるハードウェアを使うことになり、その製品のライブラリを導入しようとしているのですがうまくいきません。
おそらくDLLが正常に読み込まれていないだろうと思います。
同梱ファイルの中身は単純で、使っているものの最低限の動作確認のため、初期化を実行しようとしているだけです。
test.cpp
#include <iostream>
#include "DxLib.h"
#include "HAROC2D.hpp"
/* ドライバの初期化 */
bool initializeDriver( void )
{
int status;
status = HAROC_InitDriver( 10+1 ); /* ドライバの初期化 */
if( status != 0 ) {
/* 初期化失敗処理 */
return false;
}
else {
/* 初期化成功処理 */
return true;
}
}
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
{
if( !HAROC2manager::loadDLL() ) return 0;/* HAROC2.DLLのロード */
if( !initializeDriver() ) return 0;
HAROC2manager::freeDLL(); /* HAROC2.DLLの解放 */
return 0;
}
上のソースのHAROC_InitDriverでエラーがでており、エラーは「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を読み込んだあと正常に関数呼び出しだされていないのではないかという感じです。
hppファイルはDLLの読み込みと解放を記述しているだけです。
hppとDLLは製品に同梱されていたものです。
どなたかわかる方がいましたら回答をお願いします