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

Hi,

There is not much said about assemby routines from C its more implementation specific stuff.
However this is what the C89 standard has to say -


A.6.5.10 The asm keyword

   The asm keyword may be used to insert assembly-language code
directly into the translator output.  The most common implementation
is via a statement of the form

         asm (  character-string-literal );

So make sure you pass a character-string-literal as a param, not a void !

- Ravi

.



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. ... You have to assemble asm code into an object file. ...
    (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)
  • Re: 2.6.22-rc1-mm1: boot failure under qemu
    ... H. Peter Anvin wrote: ... locally inside an assembly routine or asm() statement. ... Another bizarre ...
    (Linux-Kernel)
  • 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)
  • Re: Problem with compiling the VP31 Codec source code.
    ... int WillametteNewInstructionOSSupport() ... __asm mov eax, 1 ... I have problem when compiling the VP31 Codec source code. ... I am sure that the ASM files with xmm0 to 7 is recognized and compiled ...
    (microsoft.public.win32.programmer.directx.video)