Archived

This topic is now archived and is closed to further replies.

Gultipaka

Dev-C++ inline asm in C code

Recommended Posts

Gultipaka    122
I have such code in Intel. Frankly I don''t really know asm well. Could someone transform this Intel code into AT&T. asm{ push 0 push 1 call RegisterServiceProcess } or how can I solve this in other way?

Share this post


Link to post
Share on other sites
Gultipaka    122
I think I found an answer:
asm("push 0; push 1; call _RegisterServiceProcess");

but now I get linker error:
undefined reference to ''RegisterServiceProcess''

Share this post


Link to post
Share on other sites
Red Drake    120
Write in
asm {
.intel_syntax noprefix

... code

.ATT_syntax
}

This way you will get intel code translated by compiler

P.S.
Sory about gramatial errors

[edited by - Red Drake on May 27, 2004 8:37:37 AM]

Share this post


Link to post
Share on other sites
Gultipaka    122
It doesn''t like it.
I get "parse error before token {" - it doesn''t understand such code asm {.., and neither does this one: asm (.intel_syntax noprefix...

Share this post


Link to post
Share on other sites
Red Drake    120
I yust rememberd that gcc/g++ dows not "see private declared objects".
I don't know anything specific about this buth I asume that your code works in VC++.
Hope this helps
If not see docs on GCC.

[edited by - Red Drake on May 27, 2004 1:44:49 PM]

[edited by - Red Drake on May 27, 2004 1:45:20 PM]

Share this post


Link to post
Share on other sites
LessBread    1415
quote:
Original post by temp_ie_cant_thinkof_name
Would this work as well?:

pushl $0;
pushl $1;
call [__imp__RegisterServiceProcess@8];




Probably. It depends on how the compiler deals with imports and how it mangles names.

// edit: compiler in the sense of compiler + linker

[edited by - lessbread on May 29, 2004 9:33:31 PM]

Share this post


Link to post
Share on other sites