Windows CE (x86) のアセンブリ言語でプログラムを作成するにはどうすればよいですか? 現在、VS2008 を Windows CE 5.0 SDK と共に使用しており、私の C++ プログラムは問題なく動作します。コードを使用して asm ファイルを作成し、それをプロジェクトに含めようとしました。
#include "stdafx.h"
#include "windows.h"
extern "C" void clear();
int _tmain(int argc, _TCHAR* argv[])
{
clear();
return 0;
}
clear.asm:
.586 ;Target processor. Use instructions for Pentium class machines
.MODEL FLAT, C ;Use the flat memory model. Use C calling conventions
.STACK ;Define a stack segment of 1KB (Not required for this example)
.DATA ;Create a near data segment. Local variables are declared after
;this directive (Not required for this example)
.CODE ;Indicates the start of a code segment.
clear PROC
xor eax, eax
xor ebx, ebx
ret
clear ENDP
END
WinApi 関数 (MessageBox) フォーム asm コードを呼び出すまで、すべてがうまくいきます。
.DATA ;Create a near data segment. Local variables are declared after
szMessageText DB "Hello world text", 0
szMessageCaption DB "HWorld capt, 0
.CODE ;Indicates the start of a code segment.
clear PROC
Invoke MessageBox, NULL, ADDR szMessageText, ADDR szMessageCaption, MB_OK
clear ENDP
END
それは与えます
エラー A2006: 未定義のシンボル: メッセージ ボックス
MASM 用の Windows CE SDK ライブラリにインクルード パスを追加しました。
C:\Program Files\Windows CE Tools\wce500\STANDARDSDK_500\Lib\x86
そしてcoredll.libを含めようとしましたが、効果はありません
includelib coredll.lib
主な質問は次 のとおりです。私の間違いはどこですか?winapi 関数を使用して asm コードを記述できますか?
あなたの答えをありがとう!
-----------------------------------------------
UPD: みんなありがとう。関数のプロト定義を書くことでプロジェクトを構築することができました:
MessageBoxW PROTO hwnd:DWORD、lpText:DWORD、lpCaption:DWORD、uType:DWORD
使用する関数ごとにそのようなプロトタイプを作成しないようにするにはどうすればよいですか? 私が理解している限り、関数のプロト定義を含む .inc ファイルが必要ですか? または何らかの方法で .h ファイルにある関数定義を使用しますか?