C++ を使用して MotorBee を制御しようとしています。問題は、MotorBee に付属の dll ファイル「mtb.dll」を使用していることです。
次のように、dll から C++ プログラムに関数をロードしようとしています。
#include "stdafx.h"
#include <iostream>
#include "mt.h"
#include "windows.h"
using namespace std;
HINSTANCE BeeHandle= LoadLibrary((LPCWSTR) "mtb.dll");
Type_InitMotoBee InitMotoBee;
Type_SetMotors SetMotors;
Type_Digital_IO Digital_IO;
int main() {
InitMotoBee = (Type_InitMotoBee)GetProcAddress( BeeHandle, " InitMotoBee");
SetMotors =(Type_SetMotors)GetProcAddress(BeeHandle, " SetMotors");
Digital_IO =(Type_Digital_IO)GetProcAddress(BeeHandle, " Digital_IO "); InitMotoBee();
SetMotors(0, 50, 0, 0, 0, 0, 0, 0, 0);
system("pause");
return 0;
}
メモリ内のアドレス 0x00000000 を読み取ろうとしているというエラーが表示されます。BeeHandle をカウントしようとすると、0x0 アドレスが表示されます (ハンドル値を確認しようとしています) サンプル エラー:
First-chance exception at 0x00000000 in 111111.exe: 0xC0000005: Access violation reading location 0x00000000.
First-chance exception at 0x6148f2b4 in 111111.exe: 0xC0000005: Access violation reading location 0x00000000.
First-chance exception at 0x6148f2b4 in 111111.exe: 0xC0000005: Access violation reading location 0x00000000.
First-chance exception at 0x6148f2b4 in 111111.exe: 0xC0000005: Access violation reading location 0x00000000.
First-chance exception at 0x6148f2b4 in 111111.exe: 0xC0000005: Access violation reading location 0x00000000.
お手伝いありがとう、