Unix Programming - How to extend a C++ base class from a shared library

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > February 2005 > How to extend a C++ base class from a shared library





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author How to extend a C++ base class from a shared library
j_mckitrick@bigfoot.com

2005-02-22, 8:49 pm

I have a handful of components that share a great deal of
functionality. In Win32, we kept a source library, and derived new
classes from the base class by linking the base class in at the source
level.

Now that we are porting to Unix, I'd like to compile the base class,
install it as a shared library, and derive from it.

How can I do this? The compiler doesn't seem to see the base class in
the shared library when I try to link it into a new class that will
extend it. Is there a special command line option or something I need
to do in the header file to make this work?

jonathon

Paul Pluzhnikov

2005-02-23, 7:54 am

j_mckitrick@bigfoot.com writes:

> The compiler doesn't seem to see the base class in
> the shared library when I try to link it into a new class that will
> extend it.


I can't parse your sentence above in any meaningful way.

Try creating a simple example showing what your code is, what
command lines you used to compile and link it, and what error was
produced while doing so.

Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
j_mckitrick@bigfoot.com

2005-02-23, 6:01 pm

Ah, I got it. I got a simple example working, so that made me check
out my makefiles. It turns out I need to add a dependency for the base
class.

Now I have CBaseClass compiled into one shared library, and another
shared library can include BaseClass.h and derive a new class that
extends it.

Thanks for your help!

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com