WindowsÓëLinux±àÒëÆ÷µÄ²îÒì
¿ªÊ¼ÒÆÖ² ¹¤×÷ºóµÄµÚÒ»²½¾ÍÊÇÔÚÄ¿±êƽ̨LinuxÉϽøÐбàÒ룬²¢Á´½ÓÔ´´úÂë¡£ÓÉÓÚÐèÒªÒÆÖ²µÄÈí¼þͨ³£²¢Î´ÔÚLinuxƽ̨ÉϱàÒë¹ý£¬±àÒëµÄ¹ý³Ì¿ÉÄÜ»áÓöµ½ºÜ´óµÄÀ§ ÄÑ¡£Ò»°ãÇé¿öÏ£¬ÓÉÀàÐÍÉùÃ÷ÒýÆðµÄ±àÒë´íÎóÊDZȽÏÈÝÒ×ÐÞ¸´µÄ¡£±ÈÈçMicrosoft C/C++µÄÍ·ÎļþʹÓÃ__declspec( dllimport/dllexport )À´ÊäÈëºÍÊä³öDLLº¯Êý£¬ÔÚLinuxÉÏ£¬°Ñº¯ÊýÉùÃ÷³Éextern “C”£¬»òÕßÔÙ½áºÏʹÓÃDEFÎļþ£¬Ê¹ÓÃÏàÓ¦µÄÁ´½ÓÃüÁî¾Í¿ÉÒÔ½â¾öÕâЩÎÊÌâ¡£µ«À§Äѵĵط½ÔÚÓÚ±àÒëÆ÷Ö®¼ä´æÔÚ²îÒìµÄ²¿·Ö£¬Í¬Ê±ÕâÒ²ÊÇ¿ÉÄÜÒýÆðºÜ¶àÔËÐÐʱÎÊ ÌâµÄÖØÒªÒòËØ£¬¶ÁÕßÓбØÒªÔÚ¿ªÊ¼ÒÆֲ֮ǰ¾Í³ä·ÖÁ˽⡣±¾½Ú²»ÄܸÅÀ¨ËùÓвî±ð£¬Ö»½²ÊöһЩÈÝÒ×±»ºöÂÔ¶øÇÒºó¹û±È½ÏÑÏÖصķ½Ãæ¡£
ÒÔVisual C++ 2003ºÍGCC 4.1.0ΪÀý¡£Ç°ÕßÊÇWindowsƽ̨µÄÖ÷Á÷±àÒëÆ÷£¬¼æÈÝÐÔÁ¼ºÃ£¬µ«ÊǶÔC++±ê×¼µÄ×ñѲ¢²»Ñϸñ¡£ÕâÒâζ׿´Ê¹¿ª·¢Õßд³ö²»Ì«·ûºÏ±ê×¼µÄ³ÌÐò£¬±àÒë Æ÷Ò²¿ÉÄÜÄÜÈÝÈÌ¡£Ïà·´µÄÊÇ£¬GCC¶Ô±ê×¼µÄ×ñÑÏà¶ÔÑϸñµÃ¶à£¬ÕâÑùºÜÈÝÒ×Ôì³ÉÔÚWindowsÔËÐÐÁ¼ºÃµÄ³ÌÐò£¬ÔÚLinuxÉÏÈ´ÒýÆðÒâÏë²»µ½µÄ±àÒëÉõÖÁÔË ÐÐʱ´íÎó¡£
£¨1£©»ù±¾ÀàÐÍ´óСºÍ½á¹¹¶ÔÆë
Ê×ÏÈÊÇ C/C++ÓïÑÔ»ù±¾ÀàÐ͵ĴóС£¬ÒÔ¼°ÏàÓ¦µÄ½á¹¹¶ÔÆëÎÊÌâ¡£µäÐ͵ÄÀý×ÓÊÇlong¹Ø¼ü×Ö¡£ÔÚVisual C++ 2003Ï£¬sizeof(long double)ÊÇ8£¬Æä´óСºÍdoubleÒ»Ö¡£µ«ÊÇÔÚGCC 4.1.0ÉÏ£¬sizeof(long double)µÈÓÚ12£¬Æä´óС±Èdouble¶à4¡£ÁíÒ»¸öºÍ´óСÏà¹ØµÄÎÊÌâÊǶÔÆëÎÊÌâ¡£²»Í¬±àÒëÆ÷µÄĬÈ϶ÔÆë´óСÊDz»Ò»ÑùµÄ¡£Ò»°ãÇé¿öϳÌÐòÂß¼¶¼¸ú¶Ô ÆëÎ޹أ¬µ«ÊÇÉæ¼°´Ó´ÅÅÌ»òÕßÍøÂçÎļþÖжÁÈ¡½á¹¹Ê±£¨Èç½âÎö×ÊÔ´£©£¬¾«È·µÄ¶ÔÆë¾ÍÊDZØÐèµÄ¡£¿¼²ìÏÂÃæµÄ³ÌÐò¶Î£º
#include <stdio.h>
struct A
{
char a;
double b;
};
int main()
{
printf("%d %d %d\n", sizeof(long double),
sizeof(long long), sizeof(A) );
return 0;
}
ÉÏÃæÕâ¶Î³ÌÐòÔÚ Visual C++ 2003±àÒëÆ÷ĬÈÏÉèÖÃÏ£¬Êä³ö½á¹ûΪ8 8 16£»ÔÚGCC 4.1.0±àÒëÆ÷ĬÈÏÉèÖÃÏ£¬ÆäÊä³öΪ12 8 12¡£´Ósizeof(A)µÄ´óС¿ÉÒÔ¿´³ö£¬Visual C++ 2003ÊÇ°´8×Ö½Ú¶ÔÆëµÄ£¬¶øgccÊÇ4×Ö½Ú¶ÔÆëµÄ¡£ÕâʱÐèҪʹÓÃ#pragma packÔ¤±àÒëÖ¸ÁîÀ´ÐÞ¸ÄÍ·ÎļþÖеĽṹÉùÃ÷£¬»òÕßÔÚÔËÐÐʱµ÷ÕûÄÚ´æÖнṹ³ÉÔ±µÄλÖᣲ»¹Ü²ÉÓúÎÖÖ·½·¨£¬¶ÔÆ붼ÊÇÐèҪСÐÄ´¦ÀíµÄÊÂÇé¡£
Ïà¹ØÎĵµ£º
Service Discovery Protocol(SDP)ÌṩһÖÖÄÜÁ¦£¬ÈÃÓ¦ÓóÌÐòÓз½·¨·¢ÏÖÄÄÖÖ·þÎñ¿ÉÓÃÒÔ¼°ÕâÖÖ·þÎñµÄÌØÐÔ¡£
·þÎñ·¢ÏÖÐÒé(SDP»òBluetooth SDP)ÔÚÀ¶ÑÀÐÒéÕ»ÖжÔÀ¶ÑÀ»·¾³ÖеÄÓ¦ÓóÌÐòÓÐÌØÊâµÄº¬Ò⣬·¢ÏÖÄĸö·þÎñÊÇ¿ÉÓõĺÍÈ·¶¨ÕâЩ¿ÉÓ÷þÎñµÄÌØÕ÷¡£SDP¶¨ÒåÁËbluetooth client·¢ÏÖ¿ÉÓÃbluetooth server·þÎñºÍËüÃǵÄÌØÕ÷µÄ·½·¨¡£ ......
1¡¢/etc/modules.confÎļþ£º
ÔÚDebian/UbuntuÅÉϵÖÐÃûΪ/etc/modules£¬ÔÚÓÐЩLinuxϵͳÖÐÒ²ÓÃÃû/etc/conf.modules¡£¸ÃÅäÖÃÎļþ¶¨ÒåÁ˸÷ÖÖÐèÒªÔÚÆô¶¯Ê±¼ÓÔصÄÄ£¿éµÄ²ÎÊýÐÅÏ¢¡£ÕâÀïÖ÷Òª×ÅÖØÌÖÂÛ¹ØÓÚÍø¿¨µÄÅäÖá£ÔÚʹÓÃLinux×öÍø¹ØµÄÇé¿öÏ£¬Linux·þÎñÆ÷ÖÁÉÙÐèÒªÅäÖÃÁ½¿éÍø¿¨¡£ÎªÁ˼õÉÙÆô¶¯Ê±¿ÉÄܳö ......
Ëæ×ÅLinuxÓ¦ÓõÄÀ©Õ¹Ðí¶àÅóÓÑ¿ªÊ¼½Ó´¥Linux£¬¸ù¾ÝѧϰWindwosµÄ¾ÑéÍùÍùÓÐһЩãȻµÄ¸Ð¾õ£º²»Öª´ÓºÎ´¦¿ªÊ¼Ñ§Æð¡£ÕâÀï½éÉÜѧϰLinuxµÄһЩ½¨Òé¡£
Ò»¡¢´Ó»ù´¡¿ªÊ¼£º³£³£ÓÐЩÅóÓÑÔÚLinuxÂÛ̳ÎÊһЩÎÊÌ⣬²»¹ý£¬ÆäÖдó¶àÊýµÄÎÊÌⶼÊǺܻù´¡µÄ¡£ÀýÈ磺ΪʲôÎÒʹÓÃÒ»¸öÃüÁîµÄʱºò£¬ÏµÍ³¸æËßÎÒÕÒ²»µ½¸ÃĿ¼£¬ÎÒÒªÈçºÎÏÞÖÆ ......
£¨±¾ÎÄÀý×Ó»ùÓÚFreeBSD/LinuxʵÏÖ£¬windows»·¾³Çë×Ô¼º×ö³öÏàÓ¦Ð޸ģ©
ÅäÖùÜÀíµÄÒ»¸öÖØҪʹÃüÊDZ£Ö¤Êý¾ÝµÄ°²È«ÐÔ£¬·ÀÖ¹·þÎñÆ÷Ó¦Ó²ÅÌË𻵡¢Îó²Ù×÷Ôì³ÉÊý¾ÝÎÞ·¨»Ö¸´µÄÔÖÄÑÐÔºó¹û¡£Òò´ËÖƶ¨Ò»¸öÍêÕûµÄ±¸·Ý²ßÂԷdz£ÖØÒª¡£
Ò»°ãÀ´Ëµ£¬±¸·Ý²ßÂÔÓ¦¹æ¶¨Èçϼ¸²¿·ÖÄÚÈÝ£º±¸·ÝƵ¶È¡¢±¸·Ý·½Ê½¡¢± ......