Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Exporting Symbols From C++ Object File

Reply
Thread Tools

Exporting Symbols From C++ Object File

 
 
chetan
Guest
Posts: n/a
 
      09-23-2004
Hi ,
myself Chetan

Is There anybody could help me ?

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 "

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 ....!!!

So I need information that how compiler checks that a perticular
symbol is private and won't allow us to call it by object from
anywhere ...

Because simply looking at the symbol table from ELF file it's not
getting clear diffrence between the public and private
functionss...!!!


So help ..!!!
 
Reply With Quote
 
 
 
 
Sharad Kala
Guest
Posts: n/a
 
      09-23-2004

"chetan" <(E-Mail Removed)> wrote in message

> Hi ,
> myself Chetan


I could guess from the header of your posting

> Is There anybody could help me ?


Sure, dozens out here.

> 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 "


I am also in great confusion as to what exactly you meant in the above
lines. Care to give an example ?

> 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 ....!!!
>
> So I need information that how compiler checks that a perticular
> symbol is private and won't allow us to call it by object from
> anywhere ...
>
> Because simply looking at the symbol table from ELF file it's not


What is an ELF file ?

> getting clear diffrence between the public and private
> functionss...!!!


Honestly I don't understand your question quite well (may be others might
feel the same). In that case it would be better that you present your
problem clearly with an example.

Sharad



 
Reply With Quote
 
 
 
 
Gregg
Guest
Posts: n/a
 
      09-23-2004
http://www.velocityreviews.com/forums/(E-Mail Removed) (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
 
Reply With Quote
 
John Harrison
Guest
Posts: n/a
 
      09-23-2004

"chetan" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) m...
> Hi ,
> myself Chetan
>
> Is There anybody could help me ?
>
> 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 "
>
> 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 ....!!!


Is that a problem? Why do you care? Are you being paranoid?

>
> So I need information that how compiler checks that a perticular
> symbol is private and won't allow us to call it by object from
> anywhere ...


It looks in the header file. If the header file has been changed by the user
there is not a lot you can do.

>
> Because simply looking at the symbol table from ELF file it's not
> getting clear diffrence between the public and private
> functionss...!!!
>


There is no answer to your problem. Public and private are meant to help the
programmer, there are not a security system to stop the unauthorized
execution of code. If that is what you are trying to do then you are going
to have to look elsewhere.

john



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
exporting symbols with ctypes? Brian Python 1 04-06-2009 07:00 AM
Exporting Extended File Info to Text File Sqwertz Computer Support 4 05-05-2008 01:20 AM
Object creation - Do we really need to create a parent for a derieved object - can't the base object just point to an already created base object jon wayne C++ 9 09-22-2005 02:06 AM
exporting an excel file from database; making changes to excel file and updating the database by importing it back Luis Esteban Valencia ASP .Net 1 01-12-2005 12:28 AM
exporting from Tkinter Canvas object in PNG Nicolas Pourcelot Python 0 01-11-2005 06:14 PM



Advertisments