¹ØÓÚC/C++µÄλÓò
ÔÚC/C++ÖÐÎÒÃÇÓÐʱΪÁ˽ÚÊ¡ÄÚ´æÕ¼Óÿռ䣬ÐèҪʹÓõ½Î»Óò£¬ÈçÏÂËùʾ´úÂ룺
struct SDummy
{
int A : 2;
int B : 8;
int C : 12;
int D : 10;
};
ÔÚ¼ÆËã»úÄÚ´æ°º¹óµÄÇé¿öÏ£¬Î»Óò²»·¦ÎªÒ»ÖÖÓÐЧµÄ½ÚÊ¡ÄÚ´æÕ¼ÓÿռäÓÖÈôúÂëÊéд±È½ÏͨË×Ò׶®µÄ·½·¨¡£µ«ÊÇÔÚÏÖ½ñÄÚ´æÏà¶Ô±ãÒ˵Äʱ´ú£¬Ó¦ÓÃÈí¼þÖÐËƺõÒѾºÜÉÙ¼ûµ½Î»ÓòµÄʹÓÃÁË¡£Î»ÓòµÄʹÓã¬ÔÚѧϰCÓïÑÔµÄʱºòÓÐѧϰ¹ý£¬µ«ÊÇÔÚʵ¼ÊÏîÄ¿ÖкÜÉÙÓõ½£¬Ò²Ã»ÓÐ×ÐϸȥÑо¿Ëü£¬Ö±µ½ÉÏÖÜÎÒΪÁËÈÃÒ»¸ö64λµÄ±äÁ¿±íʾÎÒËùÐèÒªµÄ¼¸¸öÐÅϢʱ£¬²Å½«Ëü×ÐϸȥÑо¿ÁËÒ»·¬¡£
ÎÒÔÚ×î½üµÄÏîÄ¿ÖУ¬ÐèÒªÒ»¸ö±äÁ¿£¬Í¨¹ýÕâ¸ö±äÁ¿ÄÜÖªµÀÆä±íʾµÄÄêÔÂÈÕʱ·ÖÃëµÈÐÅÏ¢¡£ÓÉÓÚÎÒÏëʹÄê¿É±íʾ20Äê¼´¿É£¬¹ÊÐèÒª5λÀ´±íʾ£»Ô¹²12Ô£¬ÐèÒª4λ£»ÈÕ¹²31ÈÕ£¬ÐèÒª5λ£»Ê±¹²24Сʱ£¬ÐèÒª5λ£»·Ö60·Ö£¬ÐèÒª6λ£»Ãë60Ã룬ÐèÒª6λ£»µ±È»»¹ÓÐÆäËüÐÅÏ¢£¬ÎÒÒ²¸ù¾ÝÐèÒª·ÖÅäÁËÏàӦλµÄλÓò¡£ÓÚÊÇÎÒд³öÁËÈçÏÂËùʾ´úÂ룺
struct SDummy
{
U8 Year : 5;
U8 Month : 4;
U8 Day : 5;
U8 Hour : 5;
U8 Minute :6;
U8 Second : 6;
U16 ID1;
U16 ID2;
U16 ID3;
U16 ID4;
};
Õâ¸ö½á¹¹ÖеÄU8¾ÍÊÇunsigned char£¬U16¾ÍÊÇunsigned short¡£µ«ÊdzÌÐòµÄÔËÐнá¹û²¢²»ÊÇ°´ÕÕÎÒµÄÏë·¨ËùµÃµÄ½á¹û¡£Õâ¸ö½á¹¹²¢²»ÊÇÎÒÏëÒªµÄÓÃ64λ¾Í¿ÉÒÔ±íʾ£¬¶øÊdz¬¹ýÁË64λËùÓÃ8×Ö½Ú£¡Î´Í꣬´ýÐø£¡
Ïà¹ØÎĵµ£º
ϵͳ»·¾³£ºWindows 7
Èí¼þ»·¾³£ºVisual C++ 2008 SP1 +SQL Server 2005
±¾´ÎÄ¿µÄ£º±àдһ¸öº½¿Õ¹ÜÀíϵͳ
ÕâÊÇÊý¾Ý¿â¿Î³ÌÉè¼ÆµÄ³É¹û£¬ËäÈ»³É¼¨²»¼Ñ£¬µ«ÊÇ×÷ΪÎÒÓÃVC++ ÒÔÀ´±àдµÄ×î´ó³ÌÐò»¹ÊÇ´«µ½ÍøÉÏ£¬ÒÔ¹©²Î¿¼¡£ÓÃVC++ ×öÊý¾Ý¿âÉè¼Æ²¢²»ÈÝÒ×£¬µ«Ò²²»ÊDz»¿ÉÄÜ¡£ÒÔÏÂÊÇÎҵijÌÐò½çÃ棬ºóÃæ ......
²ÉÓÃ×¢Èëµ½ÆäËû½ø³ÌµÄ·½·¨À´Òþ²Ø×Ô¼ºµÄ½ø³Ì¡£¾ÍÊÇ˵£¬°ÑÄãÏë×öµÄÊÂÇé¼ÄÉúµ½±ðÈ˵Ľø³ÌÀïÃæ¡£±ÈÈçIEʲôµÄ¡£¹ØÓÚ×¢ÈëµÄ·½·¨ºÜ¶à£¬ÏÂÃæÎÒ¸øÄãÒ»¸öDLL×¢ÈëµÄ·½·¨£¬Õâ¸öÊÇÎÒ×öijÍâ¹ÒʱÓùýµÄ´úÂ룬Äã²Î¿¼Ò»Ï°ѡ£
int APIENTRY _tWinMain( HINSTANCE hInstance,
  ......
LinuxÏÂCºÍC++¿ª·¢»ù´¡
»ù±¾±à³Ì¸ÅÄî
n ±à³ÌÓïÑÔ£ºC ¡¢C++
n ±àÒë(compile)£ºÔ´Îļþ£¨.c£©->Ä¿±êÎļþ(.o)
n Á¬½Ó(link)£ºÄ¿±êÎļþ(.o)->¿ÉÖ´ÐÐÎļþ
n ¿â(library)£º¾²Ì¬Á¬½Ó¿â(.a)¡¢¶¯Ì¬Á¬½Ó¿â(.so)
LinuxÏ¿ª·¢¹¤¾ß
n±à¼Æ÷£ºvi¡¢emacs¡¢´°¿Ú±à¼Æ÷
n±àÒëÆ÷£ºGCC
nµ÷ÊÔÆ÷£ºGDB
n¿ÉÖ´ÐÐÎļþ¹¤¾ß£ ......
http://www.ibm.com/developerworks/cn/aix/library/au-toughgame/index.html
Ó¢ÎÄÔÎÄ
ÒýÑÔ
¶ÔÓÚÈκÎʹÓà C ÓïÑÔµÄÈË£¬Èç¹ûÎÊËûÃÇ C ÓïÑÔµÄ×î´ó·³ÄÕÊÇʲô£¬ÆäÖÐÐí¶àÈË¿ÉÄÜ»á»Ø´ð˵ÊÇÖ¸ÕëºÍÄÚ´æй©
¡£ÕâЩµÄÈ·ÊÇÏûºÄÁË¿ª·¢ÈËÔ±´ó¶àÊýµ÷ÊÔʱ¼äµÄÊÂÏî¡£Ö¸ÕëºÍÄÚ´æ驶ÔijЩ¿ª·¢ÈËÔ±À´ËµËƺõÁîÈËη¾å£¬µ«ÊÇÒ»µ©ÄúÁ˽ ......
#include "mex.h"
#define DWORD long
#define NUMBER_OF_STRUCTS (sizeof(friends)/sizeof(struct phonebook))
#define NUMBER_OF_FIELDS (sizeof(field_names)/sizeof(*field_names))
void mexFunction(int nlhs,
mxArray * plhs[] , int nrhs,const mxArray * pahs[])
{
typedef struc ......