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

ÓÃC/C++×öDLLº¯ÊýµÄµ¼³ö·½·¨

ÓÉÓÚVC±àÒëÆ÷Óк¯ÊýÖØÃüÃûµÄ¹¦ÄÜËùÒÔ£¬È·¶¨º¯ÊýÃûÓÐÁ½ÖÖ·½Ê½£º
1.extern "C"
2.ʹÓÃ.defÎļþ
ÕâÁ½ÖÖÒ²¿ÉÒÔÒ»ÆðʹÓá£
ÏÂÃæÊÇÒ»¸öÀý×Ó£º
extern "C" _declspec(dllexport)int __stdcall JieCheng(int a)
{//½×³Ëº¯Êý¡£ÊäÈë:ÕýÕûÊý¡£Êä³ö:Õâ¸öÊýµÄ½×³ËÖµ
 int b=1;
 for(int i=1;i<=a;i++)
 {
  b=b*i;
 }
 return b;
}
extern "C" _declspec(dllexport)int _stdcall subs(int a,int b)
{//¼õ·¨º¯Êý
return a-b;
}
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
xxx.defÎļþÄÚÈÝ:
EXPORTS
JieCheng
subs
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------


Ïà¹ØÎĵµ£º

תÔØ:Hadoop Ó¦¸ÃÓÃC++ʵÏÖ£¬¶ø²»ÊÇJava

http://www.trendcaller.com/2009/05/hadoop-should-target-cllvm-not-java.html
Sunday, May 10, 2009
Hadoop should target C++/LLVM, not Java (because of watts)
< type="text/javascript">
digg_url="http://www.trendcaller.com/2009/05/hadoop-should-target-cllvm-not-java.html";
Over the years, ......

³ÌÐòÔ±µÄ×ÔÎÒÐÞÑø: ³ÌÐòÔËÐеĻùʯ C/C++ÔËÐпâ

Ò»¸öCÓïÑÔÔËÐпâ´óÖ°üº¬ÁËÈçϹ¦ÄÜ:
1. Æô¶¯ÓëÍ˳ö: °üÀ¨Èë¿Úº¯Êý¼°Èë¿Úº¯ÊýËùÒÀÀµµÄÆäËüº¯ÊýµÈ
2. ±ê×¼º¯Êý: ÓÉCÓïÑÔ±ê×¼¹æ¶¨µÄCÓïÑÔ±ê×¼¿âËùÓµÓеĺ¯ÊýʵÏÖ.
3. I/O: IO¹¦Äܵķâ×°ºÍʵÏÖ
4. ¶Ñ:¶ÑµÄ·â×°ºÍʵÏÖ
5. ÓïÑÔʵÏÖ: ÓïÑÔÖÐһЩÌØÊ⹦ÄܵÄʵÏÖ.
6. µ÷ÊÔ: ʵÏÖµ÷ÊÔ¹¦ÄܵĴúÂë.
ÔÚÕâЩÔËÐпâµÄ×é³É³É·ÖÖÐ, C ......

GCC ÐÂÊÖ c/c++

±¾ÎÄÊÇд¸ø gcc ÐÂÊÖµÄÈëÃÅÎÄÕ£¬ËùÒÔÄÚÈݱȽϼòµ¥¡£Èç¹ûÄãÖªµÀÏÂÃæ3ÌõÃüÁ¿ÉÒÔ±àÒëc++µÄ»°£¬¾Í²»ÓÃÔÚ±¾ÎÄÀË·Ñʱ¼äÁË
´úÂë:
g++ -Wall hellocpp.cpp
gcc -Wall hellocpp.cpp -lstdc++
gfortran -Wall hellocpp.cpp -lstdc++
×¢£º±¾ÎÄ×îаæÔÚwikiÖÐ http://wiki.ubuntu.org.cn/Gcchowto
£¨½¨Òé´ó¼ÒÖ±½Ó·ÃÎÊwikiÖ ......

»ªÎªC/C++±ÊÊÔÌâ ¸½´ð°¸

1.staticÓÐʲôÓÃ;£¿£¨ÇëÖÁÉÙ˵Ã÷Á½ÖÖ£©
    1)ÔÚº¯ÊýÌ壬һ¸ö±»ÉùÃ÷Ϊ¾²Ì¬µÄ±äÁ¿ÔÚÕâÒ»º¯Êý±»µ÷Óùý³ÌÖÐά³ÖÆäÖµ²»±ä¡£
    2) ÔÚÄ£¿éÄÚ£¨µ«ÔÚº¯ÊýÌåÍ⣩£¬Ò»¸ö±»ÉùÃ÷Ϊ¾²Ì¬µÄ±äÁ¿¿ÉÒÔ±»Ä£¿éÄÚËùÓú¯Êý·ÃÎÊ£¬µ«²»Äܱ»Ä£¿éÍâÆäËüº¯Êý·ÃÎÊ¡£ËüÊÇÒ»¸ö±¾µØµÄÈ«¾Ö±äÁ¿¡£
    ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ