/docs/MyDocs

To get this branch, use:
bzr branch http://darksoft.org/webbzr/docs/MyDocs

« back to all changes in this revision

Viewing changes to Development/languages/C/Samples/Plugins/Class_Unknown/main.c

  • Committer: Suren A. Chilingaryan
  • Date: 2009-04-09 03:21:08 UTC
  • Revision ID: csa@dside.dyndns.org-20090409032108-w4edamdh4adrgdu3
import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <stdio.h>
 
2
#include <dlfcn.h>
 
3
#include "interface.h"
 
4
 
 
5
typedef void (*CallFunc)();
 
6
main()
 
7
{
 
8
    PluginInterface *pi;
 
9
    Plugin *p;
 
10
    p=new Plugin;
 
11
    pi=p;
 
12
    void *handle=dlopen("1.so",RTLD_LAZY);
 
13
    pi->Call=(CallFunc)dlsym(handle,"Call__6Plugin"); /* Use "nm" */
 
14
    pi->Plugin=(CallFunc)dlsym(handle,"_Plugin__6Plugin"); /* Use "nm" */
 
15
    printf("%p %p %p\n",p,pi->Call,pi->Plugin);
 
16
    pi->Plugin();
 
17
//    p->Call();
 
18
    dlclose(handle);
 
19
/*
 
20
    handle=dlopen("2.so",RTLD_LAZY);
 
21
    p->Call=(CallFunc)dlsym(handle,"Call__6Plugin");
 
22
    printf("%p\n",p->Call);
 
23
    p->Call();
 
24
    dlclose(handle);
 
25
*/
 
26
    delete p;
 
27
}