Re: Caaling assembly routine in c
- From: Keith Thompson <kst-u@xxxxxxx>
- Date: Fri, 29 Apr 2005 20:12:40 GMT
Ravi Uday <raviuday@xxxxxxxxx> writes:
> Sachin wrote:
[...]
>> 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.
>
> 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 !
I think you've missed the point.
The use of "asm" as a keyword is mentioned as a common language
extension; it's non-standard. It's generally a way to insert assembly
language instructions inline into C code, as if they were statements.
For example:
...
printf("About to do some register manipulation\n");
asm("mov R0, R1");
printf("Done\n");
...
The OP's implementation obviously does not implement an "asm" keyword,
since he's using "asm" as a function name.
--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
.
- References:
- Caaling assembly routine in c
- From: Sachin
- Re: Caaling assembly routine in c
- From: Ravi Uday
- Caaling assembly routine in c
- Prev by Date: Re: How is strlen implemented?
- Next by Date: Re: main(int argc, char *argv[])
- Previous by thread: Re: Caaling assembly routine in c
- Next by thread: Re: Caaling assembly routine in c
- Index(es):
Relevant Pages
|