Re: Caaling assembly routine in c



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ravi Uday wrote:
>
>
> 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

I think you will find Appendix A.6.5 (Appendix J.5 in ISO 9989-1999) is
a list of "common extensions". In 9989-1999, asm() and the rest of
appendix J.5 is headed with this caveat
"The following extensions are widely used in many systems, but are not
portable to all implementations. The inclusion of any extension that
may cause a strictly conforming program to become invalid renders an
implementation nonconforming. Examples of such extensions are new
keywords, extra library functions declared in standard headers, or
predefined macros with names that do not begin with an underscore."

asm() falls into this category (it is J.5.10 in 9989-1999).


- --

Lew Pitcher, IT Specialist, Enterprise Data Systems
Enterprise Technology Solutions, TD Bank Financial Group

(Opinions expressed here are my own, not my employer's)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)

iD8DBQFCcly0agVFX4UWr64RApMgAKCDR6AEjtfTcPlJNQmbrYSk6M3a4ACgo8S5
49ppFsLG8fI/O9/n3/J0lWM=
=8zhb
-----END PGP SIGNATURE-----
.



Relevant Pages

  • Re: Rene cant handle AoAs Success
    ... take a look at the classes and extensions), and it scales pretty well ... with increasing hardware resources. ... ASM is wonderful for using fewer lines of code... ...
    (alt.lang.asm)
  • 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)
  • 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)
  • Re: Converting ASM to C
    ... is there a company who converts asm ... > of compiling a higher level language to assembler ... > that cannot be recovered from the assembler alone. ... OK, this is off-topic here, but I'm not convinced by the impossibility ...
    (comp.lang.c)
  • 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)