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

Linux shared library Loading class

Linked from: http://www.faqs.org/docs/Linux-mini/C++-dlopen.html
//1.==== main.cpp =============================================================
// How to build?
// g++ main.cpp -ldl
//=============================================================================
#include "polygon.h"
#include <iostream>
#include <dlfcn.h>
int main() {
    using std::cout;
    using std::cerr;
    // load the triangle library
    void* triangle = dlopen("./triangle.so", RTLD_LAZY);
    if (!triangle) {
        cerr << "Cannot load library: " << dlerror() << '\n';
        return 1;
    }
    // load the symbols
    create_t* create_triangle = (create_t*) dlsym(triangle, "create");
    destroy_t* destroy_triangle = (destroy_t*) dlsym(triangle, "destroy");
    if (!create_triangle || !destroy_triangle) {
        cerr << "Cannot load symbols: " << dlerror() << '\n';
        return 1;
    }
    // create an instance of the class
    polygon* poly = create_triangle();
    // use the class
    poly->set_side_length(7);
        cout << "The area is: " << poly->area() << '\n';
    // destroy the class
    destroy_triangle(poly);
    // unload the triangle library
    dlclose(triangle);
}
//2.=====polygon.h======================================
#ifndef POLYGON_HPP
#define POLYGON_HPP
class polygon {
protected:
    double side_length_;
public:
 


Ïà¹ØÎĵµ£º

Linux²Ù×÷ϵͳÄں˱àÒëÏê½â

Äں˼ò½é  
¡¡¡¡Äںˣ¬ÊÇÒ»¸ö²Ù×÷ϵͳµÄºËÐÄ¡£Ëü¸ºÔð¹ÜÀíϵͳµÄ½ø³Ì¡¢ÄÚ´æ¡¢É豸Çý¶¯³ÌÐò¡¢ÎļþºÍÍøÂçϵͳ£¬¾ö¶¨×ÅϵͳµÄÐÔÄܺÍÎȶ¨ÐÔ¡£  
¡¡¡¡LinuxµÄÒ»¸öÖØÒªµÄÌصã¾ÍÊÇÆäÔ´´úÂëµÄ¹«¿ªÐÔ£¬ËùÓеÄÄÚºËÔ´³ÌÐò¶¼¿ÉÒÔÔÚ/usr/src/linuxÏÂÕÒµ½£¬´ó²¿·ÖÓ¦ÓÃÈí¼þÒ²¶¼ÊÇ×ñÑ­GPL¶øÉè¼ÆµÄ£¬Ä㶼¿ÉÒÔ»ñÈ¡ÏàÓ¦µÄ ......

À©´óVMwareÐéÄâ»úÖÐlinuxÓ²ÅÌ¿Õ¼ä

ΪVMwareÌí¼ÓÐéÄâÓ²ÅÌ
               VMware°²×°linuxµÄʱºòĬÈÏ·ÖÅäµÄ¿Õ¼äÊÇ4GB£¬¿ÉÄܻ᲻¹»£¬Õâ¸öʱºò¿ÉÒÔͨ¹ýÔö¼ÓÒ»¿éÐéÄâÓ²ÅÌ£¬½«/usr»òÆäËûÄÚÈÝ¿½±´¹ýÈ¥½â¾öÕâ¸öÎÊÌ⣺
´´½¨ÐéÄâÓ²ÅÌ
        1¡¢¹Ø±ÕV ......

[ת]linux: ѧϰlinux/unix±à³Ì·½·¨µÄ½¨Òé

Ê×ÏÈÏÈѧѧ±à¼­Æ÷£¬vim, emacsʲôµÄ¶¼ÐС£
È»ºóѧmake fileÎļþ£¬Ö»ÒªÖªµÀÒ»µã¾ÍÐУ¬ÕâÑù¾Í¿ÉÒÔ×¼±¸±à³ÌÐòÁË¡£
È»ºó¿´¿´¡¶C³ÌÐòÉè¼ÆÓïÑÔ¡·K&R£¬ÕâÑùÄØ£¬»ù±¾ÉϾͿÉÒÔ½øÐÐÒ»°ãµÄ±à³ÌÁË£¬Ë³±ãÕÒ±¾Êý¾Ý½á¹¹µÄÊéÀ´¿´¡£
Èç¹ûÏëѧϰUNIX/LINUXµÄ±à³Ì£¬¡¶APUE¡·¾ø¶Ô¾­µäµÄ½Ì²Ä£¬¼ÓÉîһϹ¦µ×£¬Ñ§Ï°¡¶UNP¡·µÄµÚ¶þ¾í¡£ÕâÑù»ù ......

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²»Í£µØÈ¥¶Á×îеÄÄÚÈÝ£ ......

I2C×ÜÏßÔÚLinuxϵͳÖеÄÇý¶¯Éè¼Æ

1 ÒýÑÔ
¡¡¡¡Linux²Ù×÷ϵͳÒò¾ßÓÐÔ´´úÂ빫¿ª¡¢±ãÓڲüõ¡¢Óй㷺µÄ´¦ÀíÆ÷Ö§³ÖµÈÓŵ㣬³ÉΪµ±Ç°Ç¶ÈëʽϵͳµÄÈÈÃÅÑ¡Ôñ¡£»ùÓÚI2C×ÜÏߵļüÅÌÀ©Õ¹É豸Ö÷ÒªÓÃÓÚÂú×ãǶÈëʽÉ豸ÖжԶఴ¼üµÄÐèÇó£¬Çý¶¯³ÌÐòÔÚϵͳÆô¶¯Ê±¶ÔÓ²¼þ½øÐгõʼ»¯¡£ÔÚϵͳÆô¶¯ºóʵÏÖÓ²¼þºÍÓ¦ÓóÌÐòÖ®¼äµÄÊý¾Ý½»»¥¡£Õë¶ÔS3C2410΢´¦ÀíÆ÷ºÍ¼üÅÌɨÃè¹ÜÀíÆ÷¼þ£¬ÉîÈ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ