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

Linuxϵͳ¹²Ïí¿â±à³Ì

Ò»¡¢ËµÃ÷
¡¡¡¡ÀàËÆWindowsϵͳÖеĶ¯Ì¬Á´½Ó¿â£¬LinuxÖÐÒ²ÓÐÏàÓ¦µÄ¹²Ïí¿âÓÃÒÔÖ§³Ö´úÂëµÄ¸´Óá£WindowsÖÐΪ*.dll£¬¶øLinuxÖÐΪ*.so¡£ÏÂÃæÏêϸ½éÉÜÈçºÎ´´½¨¡¢Ê¹ÓÃLinuxµÄ¹²Ïí¿â¡£
¶þ¡¢´´½¨¹²Ïí¿â
ÔÚmytestso.cÎļþÖУ¬´úÂëÈçÏ£º
#include <stdio.h>
#include <stdlib.h>
int GetMax(int a, int b)
{
if (a >= b)
return a;

return b;
}
int GetInt(char* psztxt)
{
if (0 == psztxt)
return -1;

return atoi(psztxt);
}

È»ºóʹÓÃÏÂÁÐÃüÁî½øÐбàÒ룺
gcc -fpic -shared mytestso.c -o mytestso.so
-fpic ʹÊä³öµÄ¶ÔÏóÄ£¿éÊǰ´ÕÕ¿ÉÖØ¶¨Î»µØÖ··½Ê½Éú³ÉµÄ
±àÒë³É¹¦ºó£¬µ±Ç°Ä¿Â¼ÏÂÓÐmytestso.so£¬´ËʱÒѳɹ¦´´½¨¹²Ïí¿âmytestso.so¡£
Èý¡¢Ê¹Óù²Ïí¿â
¡¡¡¡¹²Ïí¿âÖеĺ¯Êý¿É±»Ö÷³ÌÐò¼ÓÔØ²¢Ö´ÐУ¬µ«ÊDz»±Ø±àÒëʱÁ´½Óµ½Ö÷³ÌÐòµÄÄ¿±êÎļþÖС£Ö÷³ÌÐòʹÓù²Ïí¿âÖеĺ¯Êýʱ£¬ÐèÒªÊÂÏÈÖªµÀËù°üº¬µÄº¯ÊýµÄÃû³Æ£¨×Ö·û´®£©£¬È»ºó¸ù¾ÝÆäÃû³Æ»ñµÃ¸Ãº¯ÊýµÄÆðʼµØÖ·£¨º¯ÊýÖ¸Õ룩£¬È»ºó¼´¿ÉʹÓøú¯ÊýÖ¸ÕëʹÓøú¯Êý¡£
ÔÚmytest.cÎļþÖУ¬´úÂëÈçÏ£º
#include <dlfcn.h>
#include <stdio.h>
int main(int argc, char* argv[])
{
void* pdlhandle;
char* pszerror;

int (*GetMax)(int a, int b);
int (*GetInt)(char* psztxt);

int a, b;
char* psztxt = "1024";

// open mytestso.so
pdlhandle = dlopen("./mytestso.so", RTLD_LAZY);
pszerror = dlerror();
if (0 != pszerror) {
printf("%s\n", pszerror);
exit(1);
}

// get GetMax func
GetMax = dlsym(pdlhandle, "GetMax");
pszerror = dlerror();
if (0 != pszerror) {
printf("%s\n", pszerror);
exit(1);
}

// get GetInt func
GetInt = dlsym(pdlhandle, "GetInt");
pszerror = dlerror();
if (0 != pszerror) {
printf("%s\n", pszerror);
exit(1);
}

// call fun
a = 200;
b = 600;
printf("max=%d\n", GetMax(a, b));
printf("txt=%d\n", GetInt(psztxt));

// close mytestso.so
dlclose(pdlhandle);
}

È»ºóʹÓÃÈçÏÂÃüÁî½øÐбàÒ룺
gcc mytest.c -ldl -o mytest
-ldlÑ¡Ï±íʾÉú³ÉµÄ¶ÔÏóÄ£¿éÐèҪʹÓù²Ïí¿â
(1)dlopen()
µÚÒ»¸ö²ÎÊý£ºÖ¸¶¨¹²Ïí¿âµÄÃû³Æ£¬½«»áÔÚÏÂÃæÎ»ÖòéÕÒÖ¸¶¨µÄ¹²Ïí¿â¡£
£­»·¾³±äÁ¿LD_LIBRA


Ïà¹ØÎĵµ£º

ʵսLinux Bluetooth±à³Ì£¨Èý£© HCI²ã±à³Ì

1. HCI²ãЭÒé¸ÅÊö£º
HCIÌṩһÌ×ͳһµÄ·½·¨À´·ÃÎÊBluetoothµ×²ã¡£ÈçͼËùʾ£º
´ÓͼÉÏ¿ÉÒÔ¿´³ö£¬Host Controller Interface(HCI)  ¾ÍÊÇÓÃÀ´¹µÍ¨HostºÍModule¡£Hostͨ³£¾ÍÊÇPC£¬ ModuleÔòÊÇÒÔ¸÷ÖÖÎïÀíÁ¬½ÓÐÎʽ£¨USB,serial,pc-cardµÈ£©Á¬½Óµ½PCÉϵÄbluetooth Dongle¡£
ÔÚHostÕâÒ»¶Ë£ºapplication,SDP,L2capµÈЭÒé ......

ʵսLinux Bluetooth±à³Ì£¨ËÄ£© L2CAP²ã±à³Ì

£¨L2CAPЭÒé¼ò½é£¬L2CAPÔÚBlueZÖеÄʵÏÖÒÔ¼°L2CAP±à³Ì½Ó¿Ú£©
Ò»£ºL2CAPЭÒé¼ò½é£º
Logical Link Control and Adaptation Protocol(L2CAP)
Âß¼­Á¬½Ó¿ØÖƺÍÊÊÅäЭÒé (L2CAP) ΪÉϲãЭÒéÌá¹©ÃæÏòÁ¬½ÓºÍÎÞÁ¬½ÓµÄÊý¾Ý·þÎñ£¬²¢Ìṩ¶àЭÒ鹦ÄܺͷָîÖØ×é²Ù×÷¡£L2CAP ³äÐíÉϲãЭÒéºÍÓ¦ÓÃÈí¼þ´«ÊäºÍ½ÓÊÕ×î´ó³¤¶ÈΪ 64K µÄ L2CAP Ê ......

Linux²é¿´Îļþ¼Ð´óСµÄÃüÁî

[root@ns1 opt]#  du -h -s /* | sort
12K     /mnt
13M     /sbin
16K     /lost+found
1.8G    /usr
194M    /root
22G     /opt
24K     /tmp
4.0K&n ......

½éÉÜLinuxϾ­µäµÄÎļþ´«Ê乤¾ß: lrzsz


¹«Ë¾ÓиöÓÃARM940T×öµÄÊÖ³Öʽ²úÆ·£¬ÎÒÃÇÒÆÖ²ÁËÒ»¸öuClinuxÉÏÈ¥£¬ÏµÍ³»¹ÊÇÔËÐв»´íµÄ¡£
ÒòΪûÓдøÍø¿Ú£¬Ö»ÓÐUSBת´®¿Ú¿ÉÒÔʹÓã¬ËùÒÔÏëѰÕÒÒ»¸öÎȶ¨µÄ´«Êä;¾¶£¬ÔÚhostºÍdeviceÖ®¼ä½»»»Îļþ¡£ÎÊÁ˺ܶàÈ˶¼²»Çå³þ£¬»¹ÊÇÒª¿¿×Ô¼ºÕÒ½â¾ö·½·¨¡£
ÔÚgoogleÉÏÕÒÁ˰ëÌ죬ÖÕÓÚÕÒµ½ÁËÒ»¸ö¿ÉÒÔͨ¹ý´®¿Ú´«ËÍÎļþµÄÈí¼þ£¬Õâ¾ÍÊǹŶ­¼ ......

linuxÏÂͳ¼ÆÊ±¼äÀà

class CTimeTickCount
{
public:
CTimeTickCount(int threadIndex, int id )
{
struct timezone tz;
gettimeofday(&m_tvStartTime, &tz);
// m_tmStartTime = ACE_OS::gettimeofday();
m_iThreadIndex ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ