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
Ïà¹ØÎĵµ£º
£¨L2CAPÐÒé¼ò½é£¬L2CAPÔÚBlueZÖеÄʵÏÖÒÔ¼°L2CAP±à³Ì½Ó¿Ú£©
Ò»£ºL2CAPÐÒé¼ò½é£º
Logical Link Control and Adaptation Protocol(L2CAP)
Âß¼Á¬½Ó¿ØÖƺÍÊÊÅäÐÒé (L2CAP) ΪÉϲãÐÒéÌá¹©ÃæÏòÁ¬½ÓºÍÎÞÁ¬½ÓµÄÊý¾Ý·þÎñ£¬²¢Ìṩ¶àÐÒ鹦ÄܺͷָîÖØ×é²Ù×÷¡£L2CAP ³äÐíÉϲãÐÒéºÍÓ¦ÓÃÈí¼þ´«ÊäºÍ½ÓÊÕ×î´ó³¤¶ÈΪ 64K µÄ L2CAP Ê ......
ÀýÒ»£º·¢ËÍSignaling Packet£º
Signaling CommandÊÇ2¸öBluetoothʵÌåÖ®¼äµÄL2CAP²ãÃüÁî´«Êä¡£ËùÒÔµÃSignaling CommandʹÓÃCID 0x0001.
¶à¸öCommand¿ÉÒÔÔÚÒ»¸öC-frame£¨control frame£©Öз¢ËÍ¡£
Èç¹ûÒªÖ±½Ó·¢ËÍSignaling Command.ÐèÒª½¨Á¢SOCK_RAWÀàÐ͵ÄL2CAPÁ¬½ÓSocket¡£ÕâÑù²ÅÓлú»á×Ô¼ºÌî³äCommand Code£¬Identi ......
°²×°ÊµÀý£ºImageMagickµÄ°²×°·½·¨
ImageMagickµÄ°²×°·½·¨ÓÐRPM·½Ê½ºÍSOURCE·½Ê½¡£Ä¿Ç°×îаæÊÇImageMagick-6.5.5¡£¿ÉÒÔ´ÓÕâ¸öÍøÖ·ÏÂÔØ£º http://www.imagemagick.org
°²×°²½Ö裺
£±£®sshÁ¬½ÓLinux·þÎñÆ÷
£²£®°ÑÏÂÔØµÄ°²×°Îļþ·Åµ½Êʵ±µÄÎļþ¼ÐÏ¡£ÀýÈ磺cd /usr/local/src¡£»òÕßÖ±½ÓÔÚ·þÎñÆ÷ÉÏÏÂÔØ¡£
3£®½âѹÏÂÔØÎļ ......
/******************************
*
* server.c
*
******************************/
#include<stdio.h>
#include<stdlib.h>
#include<sys/socket.h>
#include<sys/types.h>
#include<errno.h>
#include<string.h>
#include<netinet/in.h>
#include<sys/wait.h> ......
class CTimeTickCount
{
public:
CTimeTickCount(int threadIndex, int id )
{
struct timezone tz;
gettimeofday(&m_tvStartTime, &tz);
// m_tmStartTime = ACE_OS::gettimeofday();
m_iThreadIndex ......