hello,
i'm new to this. well, not completely new, but my knowledge is too limited to solve my problem.
i have a working win32 c++ program which works fine, but i need a fast calculating routine.
so i wrote an assembler procedure for testing purposes which should be called from the c++ program.
here's the *.asm-file:
===========================================================
.386
.387
.model flat, stdcall
option casemap:none
ASMPROC proto STDCALL
.data
PUBLIC dummy
dummy DWORD 66
.code
start:
ASMPROC PROC
LOCAL test:DWORD
mov eax,
sub eax, 06h
mov , eax
ret
ASMPROC ENDP
END start
===========================================================
ok, i got the object-file and included in my c++-projekt, which has the following lines of code at the beginning:
===========================================================
...
extern void STDCALL ASMPROC(void);
...
===========================================================
it doesn't work when i try to call ASMPROC(), gives an undefined reference.
i'm desperate...please help
thank you
i'm new to this. well, not completely new, but my knowledge is too limited to solve my problem.
i have a working win32 c++ program which works fine, but i need a fast calculating routine.
so i wrote an assembler procedure for testing purposes which should be called from the c++ program.
here's the *.asm-file:
===========================================================
.386
.387
.model flat, stdcall
option casemap:none
ASMPROC proto STDCALL
.data
PUBLIC dummy
dummy DWORD 66
.code
start:
ASMPROC PROC
LOCAL test:DWORD
mov eax,
sub eax, 06h
mov , eax
ret
ASMPROC ENDP
END start
===========================================================
ok, i got the object-file and included in my c++-projekt, which has the following lines of code at the beginning:
===========================================================
...
extern void STDCALL ASMPROC(void);
...
===========================================================
it doesn't work when i try to call ASMPROC(), gives an undefined reference.
i'm desperate...please help
thank you
You could try to use inline assembler like this:
__asm {
some code
}
or
__asm xor eax, eax
and you must have ml.exe in your bin directory.
__asm {
some code
}
or
__asm xor eax, eax
and you must have ml.exe in your bin directory.
i should have mentioned that i'm using Dev-C++ and mingW-compiler.
you're right, but really want to keep the asm stuff separate from the c++ code. so i decided to link the object files together (btw, it works for just accessing data).
thx for your idea!
you're right, but really want to keep the asm stuff separate from the c++ code. so i decided to link the object files together (btw, it works for just accessing data).
thx for your idea!
Using Masm with C++ I learned here, I use Visual C++ though
but maybe you will find enough info here in this post
http://www.asmcommunity.net/board/index.php?topic=2891
I started the post, and make a search using my user name for more,
I hope you can glue the pieces together with this info, to use Masm with C++
Andy
but maybe you will find enough info here in this post
http://www.asmcommunity.net/board/index.php?topic=2891
I started the post, and make a search using my user name for more,
I hope you can glue the pieces together with this info, to use Masm with C++
Andy
thx very much:grin:
looks very promising, i'll try it that way
andy, what do all those options mean?
like /Z and stuff
looks very promising, i'll try it that way
andy, what do all those options mean?
like /Z and stuff
it works now, thanks again.
one question remains: how do i let an ASM-proc return a value?
:stupid:
one question remains: how do i let an ASM-proc return a value?
:stupid:
I think the return value should be in eax.
So you could try to just move it to eax
So you could try to just move it to eax