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
Posted on 2002-03-09 08:17:02 by 08/15
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.
Posted on 2002-03-09 08:30:10 by ante
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!
Posted on 2002-03-09 08:40:39 by 08/15
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
Posted on 2002-03-09 09:35:07 by andy981
thx very much:grin:
looks very promising, i'll try it that way

andy, what do all those options mean?
like /Z and stuff
Posted on 2002-03-09 10:06:25 by 08/15
it works now, thanks again.

one question remains: how do i let an ASM-proc return a value?


:stupid:
Posted on 2002-03-10 09:06:28 by 08/15
I think the return value should be in eax.
So you could try to just move it to eax
Posted on 2002-03-10 10:13:53 by ante