Solved

Dynamic Libraries

Posted on 2001-08-02
6
258 Views
Last Modified: 2013-11-18
Hello

My Project is TurboIRC 3 , the sequel of TurboIRC 2000 ( www.turboirc.com ) , running under Windows and Linux .

Everything goes fine, but I want to add plugin support.

In Windows , I can load DLL's at run time and call their functions using LoadLibrary() and GetProcAddress().

My question is , 1. How to create such a shared library in linux ( e.g. Compiler options and 'exported functions' )  , and 2. How to load the libraries and call their functions from C++ .

Thanks a lot
0
Comment
Question by:WxW
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 51

Accepted Solution

by:
ahoffmann earned 100 total points
ID: 6346789
1. use -shared option for gcc (and -G for ld)
   all functions which are note declared static are exported automatically
2. see man: dlopen, dlsym, dladdr, dlerror, dlclose
   (and don'r forget to add -ldl as linker option)

> How to load the libraries and call their functions from C++
Keep in mind that this is not the UNIX/Linux-way handling
dynamic shared objects.
UNIX/Linux does not load dynamic shared objects by program code using the function from 2. above (as M$), but the linker, respectively the runtime loader (ldd), will do it automatically.
0
 
LVL 6

Author Comment

by:WxW
ID: 6348587
Thats the problem.
The libraries have the same exported functions since they work as 'plugins' : anyone can make one without my application to know what the plugin is supposed to do.
So , linking the libraries at compile-time won't help. I need run-time code-based opening and calling.


0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6348641
2. see man: dlopen, dlsym, dladdr, dlerror, dlclose

with dlopen() you load the lib, with dlsym() you get the symbols (functions, variables, etc.) in there, a.s.o. ..
0
How To Install Bash on Windows 10

Windows’ budding partnership with Canonical has certainly led to some great improvements. One of them being the ability to use Bash on your Windows machine without third party applications! This might be one of the greatest things a cloud engineer in a Windows environment can do!

 
LVL 3

Expert Comment

by:karouri
ID: 6388400
listening..
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6388897
are there some news, WxW?
0
 
LVL 6

Author Comment

by:WxW
ID: 6431153
y sorry for the delay ( vacation ! )

Thanks
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Before we dive into the marketing strategies involved with creating an effective homepage, it’s crucial that EE members know what a homepage is. In essence, a homepage is the introductory, or default page, of a website that typically highlights the …
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question