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

Linux shared library Loading function

Link from: http://www.faqs.org/docs/Linux-mini/C++-dlopen.html
//1. == main.cpp =============================================
// How to build?
// g++ -o main main.cpp -ldl
//=======================================================
#include <iostream>
#include <dlfcn.h>
int main() {
    using std::cout;
    using std::cerr;
    cout << "C++ dlopen demo\n\n";
    // open the library
    cout << "Opening hello.so...\n";
    void* handle = dlopen("./hello.so", RTLD_LAZY);
    if (!handle) {
        cerr << "Cannot open library: " << dlerror() << '\n';
        return 1;
    }
    // load the symbol
    cout << "Loading symbol hello...\n";
    typedef void (*hello_t)();
    hello_t hello = (hello_t) dlsym(handle, "hello");
    if (!hello) {
        cerr << "Cannot load symbol 'hello': " << dlerror() <<
            '\n';
        dlclose(handle);
        return 1;
    }
    // use it to do the calculation
    cout << "Calling hello...\n";
    hello();
    // close the library
    cout << "Closing library...\n";
    dlclose(handle);
}
// 2=====hello.cpp ========================================
// How to build?
// g++ -c -fPIC hello.cpp
// g++ -shared  -o hello.so
-fPIC hello.o
//======================================================
#include <


Ïà¹ØÎĵµ£º

LinuxÏÂI2CÉ豸Çý¶¯¿ª·¢ºÍʵÏÖ

¡¡I2C×ÜÏß¾ßÓнṹ¼òµ¥Ê¹Ó÷½±ãµÄÌص㡣±¾ÎÄÃèÊöÁËlinuxÏÂI2CÇý¶¯µÄ½á¹¹£¬²¢ÔÚ´Ë»ù´¡Éϸø³öÁËI2CÉ豸Çý¶¯ºÍÓ¦ÓõÄʵÏÖ¡£
¡¡¡¡1  ÒýÑÔ
¡¡¡¡I2C (Inter£­Integrated Circuit)×ÜÏßÊÇÒ»ÖÖÓÉPHILIPS¹«Ë¾¿ª·¢µÄÁ½Ïßʽ´®ÐÐ×ÜÏߣ¬ÓÃÓÚÁ¬½Ó΢¿ØÖÆÆ÷¼°ÆäÍâΧÉ豸¡£I2C×ÜÏß×îÖ÷ÒªµÄÓŵãÊÇÆä¼òµ¥ÐÔºÍÓÐЧÐÔ¡£ÓÉÓÚ½Ó¿ÚÖ±½ÓÔÚ×é¼þÖ ......

ÎÒ¿ª·¢Linux·þÎñ³ÌÐòµÄ¹¤×÷»·¾³´îÅä

àÅ£¬ÕâÊǺÍƽͬѧµÄµãÌâ×÷ÎÄÁË£¬ºÇºÇ£¬Ëû·ÇÒªÁ˽âÎÒÊÇÔõô¿ª·¢Linux³ÌÐòµÄ£¬Ö÷ÒªÊÇÕâ¸ö¹¤×÷»·¾³ÊÇÈçºÎµÄ£¿
ԭʼÎÊÌâÈçÏ£º
ÎÊ£º
ÀÏʦ£¬¿ÉÒÔдһƪÎÄÕ½éÉÜÒ»ÏÂÈçºÎʹÓÃvim´î½¨ºÃÓõÄlinux¿ª·¢»·¾³Â𣿣¨±ÈÈçvimÈçºÎÉèÖÿì½Ý¼ü¿ÉÒÔ×öµ½Ò»¼ü±àÒëºÍÔËÐУ¬³£ÓõIJå¼þÈçºÎ°²×°µÈ£©
´ð£º
ÎÒ²»»áÓÃvim£¬Ò²´Ó²»Óá£
ÎÊ£º
ÌýË ......

linux or unix ³£ÓÃÃüÁî

¿ì½Ý¼ü£ºctrl+c ctrl+d
1.shell ·ÖΪͼÐÎshellºÍÃüÁîshell ÃüÁîshell·ÖΪbashºÍcsh£¬Çл»µ½cshÓÃcsh£¬exit·µ»Øbash
2.telnet Ô¶³ÌµÇ½unix
telnet 192.168.0.25
login£ºhz0904 Óû§Ãû
password£ºsd0904 ÃÜÂë¹æÔò£º6-8¸ö×Ö·û£¬ÖÁÉÙ°üº¬×ÖĸÒÔ¼°1¸öÊý×Ö£¬²»ÄÜÓëµÇ¼ÃûÏàͬ
3.passwd£º ÐÞ¸ÄÃÜÂë>ÊäÈëÏÖÓпÚÁî>ÊäÈë ......

ÉîÈëÁ˽âLinuxÆô¶¯¹ý³Ì

±¾ÎÄÏêϸ·ÖÎöÁËLinux×ÀÃæ²Ù×÷ϵͳµÄÆô¶¯¹ý³Ì£¬Éæ¼°µ½BIOSϵͳ¡¢LILO ºÍGRUBÒýµ¼×°ÔسÌÐò£¬ÒÔ¼°bootsect¡¢setup¡¢vmlinuxµÈÓ³ÏñÎļþ£¬²¢½áºÏÒýµ¼¡¢Æô¶¯Ô­ÀíºÍ¾ßÌåµÄ´úÂëʵÏÖ»úÖÆÓÉdzÈëÉîµØ½øÐÐÁË·ÖÎö¡£
    ³õѧÕ߸սӴ¥Linux×ÀÃæϵͳ»á¸Ð¾õϵͳÆô¶¯ËٶȽÏÂý£¬ÄÇô£¬ÎªÊ²Ã´ËüµÄÆô¶¯ËÙ¶ÈÂýÄØ?±¾ÎľÍ×ÀÃæϵ ......

linuxÖÐtailÃüÁî ÓÃÓڲ鿴ÎļþÄÚÈÝ(ʵʱ¼à¿Ø)

²é¿´ÎļþÄÚÈݵÄÌØÊâ·½·¨
¡¡¡¡ÏàÐÅ×î»ù±¾µÄcatºÍless,moreÄãÒѾ­ºÜÊìϤÁË£¬Èç¹ûÓÐÌØÊâµÄÒªÇóÄØ£º
1. Èç¹ûÄãÖ»Ïë¿´ÎļþµÄÇ°5ÐУ¬¿ÉÒÔʹÓÃheadÃüÁÈ磺
head -5 /etc/passwd
2. Èç¹ûÄãÏë²é¿´ÎļþµÄºó10ÐУ¬¿ÉÒÔʹÓÃtailÃüÁÈ磺
tail -10 /etc/passwd
tail -f /var/log/messages
²ÎÊý-fʹtail²»Í£µØÈ¥¶Á×îеÄÄÚÈÝ£ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ