我在masm32中创建动态链接库时遇到问题。无论我做什么,输出总是*.exe文件,而不是*.dll。以下代码实际上是由masm32 -> Code -> Create New DLL创建的代码。我只是使用Project -> Build All来构建它。伙计们,我做错了什么?
mydll.def
LIBRARY mydll
EXPORTS my_proc
; EXPORTS [your_exported_proc_name]makeit.bat
@echo off
if exist mydll.obj del mydll.obj
if exist mydll.dll del mydll.dll
\masm32\bin\ml /c /coff mydll.asm
\masm32\bin\Link /SUBSYSTEM:WINDOWS /DLL /DEF:mydll.def mydll.obj
del mydll.obj
del mydll.exp
dir mydll.*
pausemydll.asm
; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
include \masm32\include\masm32rt.inc
include \masm32\include\windows.inc
; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
; -------------------------------------------
; Build this DLL with the provided MAKEIT.BAT
; -------------------------------------------
.data?
hInstance dd ?
.code
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
LibMain proc instance:DWORD,reason:DWORD,unused:DWORD
.if reason == DLL_PROCESS_ATTACH
mrm hInstance, instance ; copy local to global
mov eax, TRUE ; return TRUE so DLL will start
.elseif reason == DLL_PROCESS_DETACH
.elseif reason == DLL_THREAD_ATTACH
.elseif reason == DLL_THREAD_DETACH
.endif
ret
LibMain endp
My_proc proc
ret
My_proc endp
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
comment * -----------------------------------------------------
You should add the procedures your DLL requires AFTER
the LibMain procedure. For each procedure that you
wish to EXPORT you must place its name in the "mydll.def"
file so that the linker will know which procedures to
put in the EXPORT table in the DLL. Use the following
syntax AFTER the LIBRARY name on the 1st line.
LIBRARY mydll
EXPORTS YourProcName
EXPORTS AnotherProcName
------------------------------------------------------- *
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
end LibMain发布于 2013-02-10 11:23:18
如果您有Visual Studio的许可证,那么您可以使用visual studio进行masm32编程,有关如何设置Visual Studio的详细信息可以在here中找到,请按照提供的步骤转到项目属性,并在配置属性下将配置类型更改为动态库。
https://stackoverflow.com/questions/14317477
复制相似问题