Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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±à³Ì£¨ËÄ£© L2CAP²ã±à³Ì

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

ʵսLinux Bluetooth±à³Ì(Áù) 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 ......

Linux °²×°Èí¼þ ͨÓ÷½·¨


°²×°ÊµÀý£ºImageMagickµÄ°²×°·½·¨
ImageMagickµÄ°²×°·½·¨ÓÐRPM·½Ê½ºÍSOURCE·½Ê½¡£Ä¿Ç°×îаæÊÇImageMagick-6.5.5¡£¿ÉÒÔ´ÓÕâ¸öÍøÖ·ÏÂÔØ£º http://www.imagemagick.org
°²×°²½Ö裺
£±£®sshÁ¬½ÓLinux·þÎñÆ÷
£²£®°ÑÏÂÔØµÄ°²×°Îļþ·Åµ½Êʵ±µÄÎļþ¼ÐÏ¡£ÀýÈ磺cd /usr/local/src¡£»òÕßÖ±½ÓÔÚ·þÎñÆ÷ÉÏÏÂÔØ¡£
3£®½âѹÏÂÔØÎļ ......

linuxÏÂIP v6 tcp·þÎñÆ÷¶ËÔ´ÂëʾÀý

/******************************
*
* 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> ......

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ºÅ