Re: Exporting Symbols From C++ Object File
From: Gregg (gregg_at_invalid.invalid)
Date: 09/23/04
- Next message: learning_C++: "How can I creat a time function or a class?"
- Previous message: Sharad Kala: "Re: Exporting Symbols From C++ Object File"
- In reply to: chetan: "Exporting Symbols From C++ Object File"
- Next in thread: John Harrison: "Re: Exporting Symbols From C++ Object File"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 23 Sep 2004 05:26:22 GMT
rolf21@indiatimes.com (chetan) wrote in news:4cb1a40c.0409222045.9e8b674
@posting.google.com:
> I am working on the project in c++ ,, I am in great confusion that
> should I export c++ member functions OR methods to create objects of
> that class OR
> previously cretaed objects .. So those can be used by users by using
> the header file ... of my " class "
It sounds like you want to put a class in a library that users can link
with. Is that correct?
Unlike C, there is no industry standard for storing C++ symbol
information in an object file (like "ELF") that is compatible with all
compilers. You will probably therefore have to use the same compiler for
both the library and the client code if you want to link symbolically.
The alternative that is commonly done is to export an extern "C" function
that is responsible for creating the object, which must have all virtual
functions. The client then invokes functions through an abstract
interface so it does not need to link symbolically. This is basically
what COM does in Windows.
> But by exporting member functions of C++ class user would not
> understand
> which are the private // public functions and would get compilation
> error ..!!!
> OR may simply change the header file from private to public and would
> use
> private functions ....!!!
The public/private stuff is not represented in the binary file because it
is only used at compile time, not run time. The client compiler will know
which is private and which is public from the header file. You are right
that the user could edit the header file, the access modes could be
chcanged. That is the case even without libraries. It is only a compile-
time mechanism.
Gregg
- Next message: learning_C++: "How can I creat a time function or a class?"
- Previous message: Sharad Kala: "Re: Exporting Symbols From C++ Object File"
- In reply to: chetan: "Exporting Symbols From C++ Object File"
- Next in thread: John Harrison: "Re: Exporting Symbols From C++ Object File"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|