From: Jan-Benedict Glaw <jbglaw@lug-owl.de>
To: linux-c-programming@vger.kernel.org
Subject: Re: dynamic linking
Date: Wed, 11 Sep 2002 17:43:53 +0200 [thread overview]
Message-ID: <20020911154353.GN1386@lug-owl.de> (raw)
In-Reply-To: <15740.44857.172146.892963@cerise.nosuchdomain.co.uk>
[-- Attachment #1: Type: text/plain, Size: 1096 bytes --]
On Mon, 2002-09-09 15:24:57 +0100, Glynn Clements <glynn.clements@virgin.net>
wrote in message <15740.44857.172146.892963@cerise.nosuchdomain.co.uk>:
> > Is it possible to import let's say a class using dlopen?
>
> No; classes don't exist. At least, they don't exist as data within a
> binary (object file, library, executable). Classes only exist within
> the C++ compiler. The object files only contain individual functions
> and (global) variables.
>
> While it is possible to dynamically load libraries which are written
> in C++, it's a lot easier if you write C wrappers for the entry
> points.
For each classes constructor, also create a C'ish function exporting a
instantiated class as a void pointer. Then, you'll get access to classes
within the object file (*).
MfG, JBG
(*) It's more or less the only way, but personally I don't like OO
programming, so I don't use it, but co-workers of me do.
--
Jan-Benedict Glaw . jbglaw@lug-owl.de . +49-172-7608481
-- New APT-Proxy written in shell script --
http://lug-owl.de/~jbglaw/software/ap2/
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2002-09-11 15:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-08 20:00 dynamic linking Wrazlov
2002-09-08 20:03 ` Wrazlov
2002-09-08 21:06 ` Holger Freyther
2002-09-09 11:06 ` Wrazlov
2002-09-09 14:24 ` Glynn Clements
2002-09-11 15:43 ` Jan-Benedict Glaw [this message]
2002-09-09 20:39 ` Progga
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20020911154353.GN1386@lug-owl.de \
--to=jbglaw@lug-owl.de \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).