Helo,
where can i find a sample or documentation about using :
functions.asm << some funcs like
proc my_msgbox
endp my_msgbox
end
main.cpp
extern "c" void my_msgbox;
void main()
{
my_messagebox();
}
would this work, ? and is this linker safe?
Hi oversight,
Welcome to the forum.
Here is a simple example for you:
.386
.model flat,stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\user32.inc
Msgbox PROTO :DWORD
.data
caption db 'assembly mixed with C++',0
.code
Msgbox PROC string:DWORD
invoke MessageBox,0,string,ADDR caption,MB_OK
ret
Msgbox ENDP
END
extern "C" void __stdcall Msgbox(char * );
int __stdcall WinMain(int hInstance, int hPrevInstance,char *lpCmdLine, int nCmdShow)
{
Msgbox("This is a demo");
return 0;
}
\masm32\bin\ml /c /coff Msgbox.asm
cl Test.cpp Msgbox.obj \masm32\lib\user32.lib
Example C++ source file compiled MS VC++ Toolkit 2003
[attachment deleted by admin]
thanx man,
i am working on soldner project zero, and i was thinking about faster networking.
Then i got the idiea to call all networking code from assembler and expand/optimize that later.
it has been a while since i coded in asm.
www.project-zero.info
www.secretwars.net
currently we are not on any payroll, i hope that changes...
thanx again!
Vortex,
Thanks for providing these ....
Would it be possible for these files to be part of masm32\examples or masm32\tutorial?
Or is there already something equivalent available for newbies like myself who are, at this point, primarily interested in calling asm functions from C/C++?
Hi l_d_allan,
You are welcome. You can find various examples about using C with asm on the net. Please feel free to ask any kind of questions about C & asm. Would you like to see other examples? Maybe, at the week-end, I can send other demos.