ÓÃ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
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
Ïà¹ØÎĵµ£º
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, ......
ubuntuϵÄc/c++»·¾³´î½¨ÊDZȽϼòµ¥,ÒòΪÓÐaptºÍÐÂÁ¢µÃµÄ°ïÖú.
1.
Ê×ÏÈÊÇÅäÖÃgcc,ÔÚubuntu°²×°Íê³ÉÒѾÓÐgccÁË(gccÊÇÓÉGNUÖ®¸¸StallmanËù¿ª·¢µÄlinuxϵıàÒëÆ÷£¬È«³ÆÎªGNU
Compiler Collection£¬ Ŀǰ¿ÉÒÔ±àÒëµÄÓïÑÔ°üÀ¨£ºC, C++, Objective-C, Fortran, Java,
and
Ada.).µ«ÊÇgcc»¹²»ÄܱàÒëÎļþ.ÒòΪȱÉÙһЩͷÎļþ.Ä ......
#include <stdio.h>
unsigned int reverse_bits(unsigned int value)
{
unsigned int answer;
unsigned int i;
answer = 0;
for(i=1;i!=0;i<<=1){ //´ËÑ»·¿ÉÒÔºöÂÔ»úÆ÷µÄ²îÒì¡£64λºÍ32λ½Ô¿ÉÓã¬Ôö ......
±¾ÎÄÊÇд¸ø 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Ö ......
< type="text/javascript">
document.body.oncopy = function() {
if (window.clipboardData) {
setTimeout(function() {
var text = clipboar ......