LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-04-2007, 11:44 PM   #1
go939
LQ Newbie
 
Registered: Jun 2007
Posts: 15

Rep: Reputation: 0
using dlsym()


hey there!

how can i use dlsym() to open a class name and its functions?
because my program have lots of classes. so i need to open first the class in order to call its functions.

thanks
 
Old 11-05-2007, 05:00 PM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hey there!

That's not really what dlsym is for.

What language are these classes written in? Do that language have built-in support for dynamic loading (like Java, for example)?

If you're programming in C++, you can certainly use shared libraries ... but your shared object would typically contain *many* classes. And you'd have to invent your own protocol for a) "discovering" which library to load, and b) which class(es) to load from that library.

Apple has some very interesting guidelines for what kinds of things to consider if you wish to create your own shared libraries:

http://developer.apple.com/documenta...idelines.html#

Last edited by paulsm4; 11-05-2007 at 05:03 PM.
 
Old 11-05-2007, 11:20 PM   #3
go939
LQ Newbie
 
Registered: Jun 2007
Posts: 15

Original Poster
Rep: Reputation: 0
I'm using c/c++ language in Linux platform (fedora core 6). I'm a newbie in creating shared libraries (dynamically) in linux. The only problem i have right now is how to use this dlsym(). I already google it and read articles concerning with this topic.

Below is my partial test code:

int main()
{
void* handle;

handle = dlopen ("/usr/local/lib/testdll.so", RTLD_LAZY);

if (handle == (void*)0)
{
fputs (dlerror(), stderr);
exit (-1);
}

...
...

dlclose (handle);
}

I don't know how to implement my dlsym() in this code.

here's my test program (not for dll).
int main()
{
CToyControl *lc;
lc = new CToyControl (" ", NULL);

...
...

return 0;
}

Last edited by go939; 11-05-2007 at 11:35 PM. Reason: not yet finished
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
undefined reference to dlopen, dlclose, dlsym and dlerror patrickdepingui Slackware 5 02-14-2010 08:55 AM
compiling wpa_supplicant - howto fix dlerror, dlsym, dlopen, dlclose errors ichrispa Linux - Software 2 07-20-2007 06:03 AM
undefined reference to `dlsym' bahadur Programming 10 05-12-2007 04:23 PM
help translating pascal's libc "dlopen , dlsym and dlclose" into c source ... alred Programming 1 04-30-2006 04:49 PM
dlsym returning NULL tim_l Programming 2 02-02-2004 08:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:41 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration