This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: How to create objects of a class defined in .so file?
- To: "Rajesh Lolam" <rajeshlolam at rediffmail dot com>
- Subject: Re: How to create objects of a class defined in .so file?
- From: Alexandre Oliva <aoliva at redhat dot com>
- Date: 05 Dec 2000 15:00:12 -0200
- Cc: "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Organization: GCC Team, Red Hat
- References: <20001204142814.27454.qmail@mailweb21.rediffmail.com>
On Dec 4, 2000, "Rajesh Lolam" <rajeshlolam@rediffmail.com> wrote:
> 1> How to create an object of class (SharedClass)?
Create an extern "C" function that returns pointers to such objects,
and use dlsym() to obtain a pointer to that function.
> 2> How to use methods of class (SharedClass?)
For this to work, you'll either have to wrap all class methods with
extern "C" functions, and use dlsym to get their addresses, or link
the library explicitly into your application, instead of dlopen()ing
it, so that your code can refer explicitly to the methods.
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist *Please* write to mailing lists, not to me