[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gomd-devel] Dynamic class loader: example
From: |
Gian Paolo Ghilardi |
Subject: |
[gomd-devel] Dynamic class loader: example |
Date: |
Sat, 29 Mar 2003 22:56:01 +0100 |
Hi all.
I've read some docs to understand how to instance a class from a library in
Linux.
BTW: Linux's lib loading functions are "pure" C functions and, obviously,
dont' understand what's a class... :)))
I hope you all like this simple example of dynamic class loading.
The package contains 3 files:
- main.cpp (main code: contains the calls to Linux's library loader)
- libgomd.cpp (is the class loaded at runtime)
- lgomd.hpp (an header used by both main.cpp and libgomd.cpp: so the main
app knows what to load!)
How to compile:
- main.cpp: g++ main.cpp -o testlib.app -ldl
- libgomd.cpp: g++ libgomd.cpp -o libgomd.so -shared
How to execute
- ./testlib.app [nodeId]
Obviously the two binaries must be in the same directory... :)
Reference links:
- http://www.linuxjournal.com/article.php?sid=3687
- http://www.jdkoftinoff.com/linux1.html
-
http://www.ibiblio.org/pub/Linux/docs/HOWTO/mini/other-formats/pdf/C++-dlope
n.pdf
I need you comments... :)
Bye.
<rejected>
testlib.tgz
Description: Binary data
- [gomd-devel] Dynamic class loader: example,
Gian Paolo Ghilardi <=