Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

A51: CALLING C FUNCTIONS from ASSEMBLY

ÒÔÏÂÈ«ÎÄתÔØ×Ôhttp://www.keil.com/support/docs/697.htm                       Copyright © 2010 Keil™, An ARM® Company.
Information in this article applies to:
C51 Version 5 and Later
QUESTION
I wish to call a function written in C from my assembly code. How do I do it?
ANSWER
The easiest way to achieve this is to let the C compiler generate the correct assembly code for you.
Suppose you have a C function called 'foo' which takes a single unsigned char argument and returns an unsigned char value. In a new C file write a dummy function that calls 'foo'. For example:
#pragma src
extern unsigned char foo(unsigned char);
void dummy(void)
{
unsigned char x,y;
x = 1;
y = foo(x);
}
#pragma SRC directs the C compiler to generate assembly code when the file is compiled. The extension of the assembly file will be 'src'.
If you view the src file you will see how to call the function 'foo' from assembly. It shows the registers or memory locations used to pass the function arguments and which registers or memory locations are used to return a value. In addition it also gives you the correct function naming convention to use, which is essential for interfacing assembly to C.
You can then use the src file as a template to write the function call in your own assembly code. Note that you must also include the EXTRN directive for the function, eg:
EXTRN CODE (_foo)
Permission to use documents and related graphics available from this server ("Server") is granted, provided that (1) the below copyright notice appears in all copies and that both the copyright notice and this permission notice appear, (2) use of documents and related graphics available from this Server is for informational and non-commercial or personal use only, (3) no documents or related graphics, including logos, available from this Server are modified in any way


Ïà¹ØÎĵµ£º

ÓÃCдµÄ3DÃÔ¹¬

          Boss˵£¬Òª¿´OpenGL£¬¿´ÁË¿ìÒ»¸öÔ£¬×ÜËã³öÁ˸öÏñÑùµÄ¶«Î÷£¬ÓÃCдÁ˸ö3DÃÔ¹¬£¬
ËäȻֻÓÐ350ÐÐ
       ´úÂ룬²»¹ý±ßѧ±ßд£¬×ã×ãдÁËÒ»ÖÜʱ¼ä£¬»¹ÊÇСÓгɾ͸еģ¬»î»î»î£¡
         &n ......

¾­µäC/C++ÃæÊÔÌ⣨һ£©

£¨±¾ÎÄÊÕ¼¯ÖÁÍøÂ磩
1.½éÉÜÒ»ÏÂSTL£¬Ïêϸ˵Ã÷STLÈçºÎʵÏÖvector¡£
     STL (±ê׼ģ°æ¿â£¬Standard Template Library)ËüÓÉÈÝÆ÷Ëã·¨µü´úÆ÷×é³É¡£
     STLÓÐÒÔϵÄһЩÓŵ㣺
     ¿ÉÒÔ·½±ãÈÝÒ×µØʵÏÖËÑË÷Êý¾Ý»ò¶ÔÊý¾ÝÅÅÐòµ ......

¾­µäC/C++ÃæÊÔÌ⣨ËÄ£©

£¨Î壩
40. Á´±íÌ⣺һ¸öÁ´±íµÄ½áµã½á¹¹
struct Node
{
int data ;
Node *next ;
};
typedef struct Node Node ;
(1)ÒÑÖªÁ´±íµÄÍ·½áµãhead,дһ¸öº¯Êý°ÑÕâ¸öÁ´±íÄæÐò ( Intel)
Node * ReverseList(Node *head) //Á´±íÄæÐò
{
i ......

Pro*C¶Ôinner joinµÄÖ§³ÖÇé¿ö

ÕûÀí×Ô£ºhttp://forums.oracle.com/forums/thread.jspa?threadID=664180&tstart=0
ÎÊ£ºIs it possible to use INNER JOIN's with Pro*C? I'm currently getting this error:
INNER JOIN t_diagnosis b ON a.sak_diag = b.sak_diag
....1
PCC-S-02201, Encountered the symbol "INNER" when expecting on ......

NetBeans + MinGW µÄ C/C++ ¿ª·¢»·¾³ÅäÖÃ


Ç°ÃæµÄÎÄÕ¡¶´î½¨»ùÓÚ NetBeans µÄ OpenGL ¿ª·¢»·¾³¡·Ìáµ½ÁË NetBeans ºÍ MinGW µÄÅäÖ㬵±Ê±¼ÇµÃºÃÏñÒÔǰд¹ý²½Ö裬¾ÍËæÊÖÂÔ¹ýÁË¡£½ñÌìÊÕµ½ÍøÓѵÄÌáÐѲŷ¢ÏÖÊÇÎҼǴíÁË£¬ÔÚÕâÀï²¹ÉÏ£¬Í¬Ê±Ð»Ð»Ä㣡
¡¡¡¡²½ÖèÈçÏ£º
ÏÂÔØ×Ô¶¯ MinGW °²×°³ÌÐò£¬Õâ¶Ô³õѧÕßÀ´ËµÊDZȽϷ½±ãµÄ·½Ê½£¬È±µã¾ÍÊÇÏÂÔØËÙ¶ÈÂýµÃ²»ÈçÎÏÅ£¡£
ÔËÐ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ