473,394 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Exporting Symbols From C++ Object File

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 ..!!!
Jul 22 '05 #1
3 3912

"chetan" <ro****@indiatimes.com> 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

Jul 22 '05 #2
ro****@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
Jul 22 '05 #3

"chetan" <ro****@indiatimes.com> wrote in message
news:4c*************************@posting.google.co 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

Jul 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Torbak | last post by:
I got some question about symbols in libraries ... In libraries, there is public symbols and "not public" symbols (private, static)... In C when we use the "static" keyword on the declaration of...
1
by: Torbak | last post by:
I got some question about symbols in libraries ... In libraries, there is public symbols and "not public" symbols (private, static)... In C when we use the "static" keyword on the declaration of...
0
by: Otis Hunter | last post by:
I have been fighting with this for days and your expert help is needed! Below is the code I am executing which results with "Object doesn't support this property or method". The error is occuring...
0
by: Niall | last post by:
I'm attempting to put a C# front end on my unmanaged C++ ray tracer code. It's still in experimental stage, as I have never done anything with exporting types from an unmanaged dll through to a...
47
by: Pierre Barbier de Reuille | last post by:
Please, note that I am entirely open for every points on this proposal (which I do not dare yet to call PEP). Abstract ======== This proposal suggests to add symbols into Python. Symbols...
1
by: mark.heyden | last post by:
Hi Frends, I am facing problems while trying to export data into pipe format. In fact I am fetching records from mysql database and then trying to create a text file ( using pipe as delimeter) ,...
3
by: Bilgehan.Balban | last post by:
Hi, My observation was that a function with `inline' qualifier has file scope in C++ and it's symbol is not exported. Contrary to this, in C an `inline' function symbol is exported, unless it...
6
by: Notre Poubelle | last post by:
Hello, I have a strange situation where I'm trying to export a function in a class, but it won't get exported. I actually have a couple of header and cpp files. Each pair of header and cpp...
12
by: 2b|!2b==? | last post by:
I want to export my C++ classes in a DLL, using ordinal # - rather than by name. Will anyone care to enumerate through the steps required to do this? I am already failiar with exporting classes...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.