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
Ïà¹ØÎĵµ£º
1. HCI²ãÐÒé¸ÅÊö£º
HCIÌṩһÌ×ͳһµÄ·½·¨À´·ÃÎÊBluetoothµ×²ã¡£ÈçͼËùʾ£º
´ÓͼÉÏ¿ÉÒÔ¿´³ö£¬Host Controller Interface(HCI) ¾ÍÊÇÓÃÀ´¹µÍ¨HostºÍModule¡£Hostͨ³£¾ÍÊÇPC£¬ ModuleÔòÊÇÒÔ¸÷ÖÖÎïÀíÁ¬½ÓÐÎʽ£¨USB,serial,pc-cardµÈ£©Á¬½Óµ½PCÉϵÄbluetooth Dongle¡£
ÔÚHostÕâÒ»¶Ë£ºapplication,SDP,L2capµÈÐÒé ......
£¨L2CAPÐÒé¼ò½é£¬L2CAPÔÚBlueZÖеÄʵÏÖÒÔ¼°L2CAP±à³Ì½Ó¿Ú£©
Ò»£ºL2CAPÐÒé¼ò½é£º
Logical Link Control and Adaptation Protocol(L2CAP)
Âß¼Á¬½Ó¿ØÖƺÍÊÊÅäÐÒé (L2CAP) ΪÉϲãÐÒéÌá¹©ÃæÏòÁ¬½ÓºÍÎÞÁ¬½ÓµÄÊý¾Ý·þÎñ£¬²¢Ìṩ¶àÐÒ鹦ÄܺͷָîÖØ×é²Ù×÷¡£L2CAP ³äÐíÉϲãÐÒéºÍÓ¦ÓÃÈí¼þ´«ÊäºÍ½ÓÊÕ×î´ó³¤¶ÈΪ 64K µÄ L2CAP Ê ......
[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 ......
¹«Ë¾ÓиöÓÃARM940T×öµÄÊÖ³Öʽ²úÆ·£¬ÎÒÃÇÒÆÖ²ÁËÒ»¸öuClinuxÉÏÈ¥£¬ÏµÍ³»¹ÊÇÔËÐв»´íµÄ¡£
ÒòΪûÓдøÍø¿Ú£¬Ö»ÓÐUSBת´®¿Ú¿ÉÒÔʹÓã¬ËùÒÔÏëѰÕÒÒ»¸öÎȶ¨µÄ´«Êä;¾¶£¬ÔÚhostºÍdeviceÖ®¼ä½»»»Îļþ¡£ÎÊÁ˺ܶàÈ˶¼²»Çå³þ£¬»¹ÊÇÒª¿¿×Ô¼ºÕÒ½â¾ö·½·¨¡£
ÔÚgoogleÉÏÕÒÁ˰ëÌ죬ÖÕÓÚÕÒµ½ÁËÒ»¸ö¿ÉÒÔͨ¹ý´®¿Ú´«ËÍÎļþµÄÈí¼þ£¬Õâ¾ÍÊǹŶ¼ ......
class CTimeTickCount
{
public:
CTimeTickCount(int threadIndex, int id )
{
struct timezone tz;
gettimeofday(&m_tvStartTime, &tz);
// m_tmStartTime = ACE_OS::gettimeofday();
m_iThreadIndex ......