When you create the dll, there should be a .lib file created...this need to be used with your main program
Kuph:
To whet your appitite;
KuphDll.asm
Code:
.386
.model flat,stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\user32.inc
includelib \masm32\lib\user32.lib
include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib
hello proto
DllEntry proto hInstDLL: HINSTANCE, reason: DWORD, reserved1: DWORD
.DATA
MyStr BYTE "Hi Kuphryn!",'0'
hCon HANDLE NULL
dwDummy DWORD NULL
;#####################################################
;#####################################################
; STARTUP
.CODE
DllEntry proc hInstDLL: HINSTANCE, reason: DWORD, reserved1: DWORD
mov eax,TRUE
ret
DllEntry Endp
hello proc
invoke GetStdHandle,STD_OUTPUT_HANDLE
mov hCon,eax
invoke WriteConsole,hCon,ADDR MyStr,11,ADDR dwDummy,NULL
ret
hello endp
end DllEntry
KuphDll.def
Code:
LIBRARY KuphDll
EXPORTS hello
Build.bat
Code:
'Change these paths if needed
C:\masm32\BIN\ML.EXE /c /coff /Cp KuphDll.asm
C:\masm32\BIN\LINK.EXE /DLL /DEF:KuphDll.def /SUBSYSTEM:WINDOWS /LIBPATH:c:\masm32\lib KuphDll
PAUSE
Now that should produce a dll and a lib....
Now...Kuph.Cpp
Code:
extern "C" void __stdcall hello(void);
int main(void){
hello();
return 0;
}
Make sure you include the lib in the cpp project and have the dll in the same dir as the exe.........
Gotta love MASM......all the cool, but stripped to the flesh!!!!!