-
-
[求助]尝试在VC6.0中调用asm子程序的试验
-
发表于:
2005-1-29 13:57
4380
-
MixTest.cpp
/*----------------------------------------------------
A simple program written to demonstrate mixed
programming of C and Asm
cyclotron [BCG][DFCG][FCG][OCN]
----------------------------------------------------*/
#include <windows.h>
#include "resource.h"
extern "C" long AsmProc(void);
LRESULT CALLBACK DialogProc (HWND, UINT, WPARAM, LPARAM);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nShowCmd)
{
DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_DIALOG),
NULL, (DLGPROC)DialogProc, NULL);
return 0;
}
LRESULT CALLBACK DialogProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
case WM_INITDIALOG:
break;
case WM_COMMAND:
switch(wParam)
{
case ID_OK:
SetDlgItemText(hWnd, IDC_EDIT, (const char*)AsmProc());
break;
case ID_EXIT:
EndDialog(hWnd ,NULL);
}
return 0;
case WM_CLOSE:
EndDialog(hWnd ,NULL);
return 0;
}
return 0;
}
AsmProc.asm
;//////////////////////////////////////////////
;///////////// MixTest ///////////////
;/// by cyclotron[BCG][DFCG][FCG][OCN] ////
;//////////////////////////////////////////////
.386
.model flat,stdcall
option casemap:none
include windows.inc
include kernel32.inc
include user32.inc
includelib kernel32.lib
includelib user32.lib
.data
szTitle db 'MixTest',0
szText db 'MixTest',0
.code
public _AsmProc
_AsmProc proc
;invoke MessageBox,NULL,offset szTitle,offset szText,MB_OK
mov eax,offset szText
ret
_AsmProc endp
end
链接结果总是提示:
Linking...
MixTest.obj : error LNK2001: unresolved external symbol _AsmProc
Debug/MixTest.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
MixTest.exe - 2 error(s), 0 warning(s)
请问是什么原因?
下载:MixAsm.rar
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课