Re: Caaling assembly routine in c



Sachin wrote:
Hi All,

I am working on MIPS architecture and I am
compiling my project using GHS tool chain.

I want to call a assembly routine into c function.
My code is like that:

.globl asm
.ent asm

asm:
----
----
.end asm

I am calling this routine in c function like that:

extern void asm(void);

void foo()
{
  asm();
}

On compiling, error message comes that symbol asm unresolved.

Could any one tell that how I can do it for GHS.

Regards,
Sachin

I think you are havind asm code in a separate file. You have to assemble asm code into an object file. And then compile C code to an object file. After you have both object files, link them and this creates an executable.

(I assume that your asm code handles all the code calling conventions,
that standard C specifies OR your compiler requires)
.



Relevant Pages

  • Re: Caaling assembly routine in c
    ... I want to call a assembly routine into c function. ... .globl asm ... On compiling, error message comes that symbol asm unresolved. ... The most common implementation ...
    (comp.lang.c)
  • Caaling assembly routine in c
    ... compiling my project using GHS tool chain. ... I want to call a assembly routine into c function. ... ..globl asm ...
    (comp.lang.c)
  • ASM objects?
    ... is it optimal to be using many 'subroutines' in an ASM ... I am thinking of making a graphical interface where ASM code can be put ... Primary function: Coprocessor ...
    (alt.lang.asm)
  • Re: Blowfish encryption
    ... direct inlining of ASM code: IIRC it requires obtaining the Byte-Code ... EMITing the instruction / pulling the result off the stack -> getting ... routines in separate objs from the C objs. ...
    (comp.lang.clipper)
  • Re: Caaling assembly routine in c
    ... > Sachin wrote: ... >> .globl asm ... >> On compiling, error message comes that symbol asm unresolved. ... "The following extensions are widely used in many systems, ...
    (comp.lang.c)