473,387 Members | 1,553 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,387 software developers and data experts.

C++ shared objects

I have written a program which inherits a calss from a different shared object. I have linked that shared object when I compile my program using the -shared <path>/blah.so

My question is how exactly do I include the parent class in my program. When I tried to use

#include<parent.h>

class child : public parent {

}

the compiler complains. The class parent is in blah.so which I am linking.

Please help
Oct 17 '06 #1
4 3343
tyreld
144 100+
What exactly does the compiler complain about? The actual compiler message would be helpful in determining what might be the problem. Have you told the compiler where to find the include file? If it isn't in the working directory or the default include path it won't be found.
Oct 18 '06 #2
What exactly does the compiler complain about? The actual compiler message would be helpful in determining what might be the problem. Have you told the compiler where to find the include file? If it isn't in the working directory or the default include path it won't be found.
OK, I admit I dont know anything abt linking. This is the question I have.

Say I just have the .so file of another C++ program and dont have access to the source code (.h or .cpp). How do I inherit a class in my current program just by linking the .so file?

First of all, is it possible?

This is the situation I was in in the above post.

I tried to compile my program using :
g++ -shared <path>/parent.so ..... (where parent.so is the shared object)

Am I right with the command line?
Oct 18 '06 #3
tyreld
144 100+
You can't. You need the ".h" or ".cpp" file that contains the class definition you want to inheiret from just to compile your existing code into an object file.
Oct 18 '06 #4
I have written a program which inherits a calss from a different shared object. I have linked that shared object when I compile my program using the -shared <path>/blah.so

My question is how exactly do I include the parent class in my program. When I tried to use

#include"parent.h"

class child : public parent {

}

the compiler complains. The class parent is in blah.so which I am linking.

Please help
i hope it will work but this is the key idea to solve it
Oct 18 '06 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: pramod | last post by:
Is it possible to realize shared base object (without resorting to static)? What i mean is a different base objects (of same type), each of which can be shared across multiple derived classes...
1
by: myren, lord | last post by:
When I first discovered shared memory (between multiple processes) I immediately started thinking of how to build my own VM subsystem + locking mechanisms for a large single block of memory. This...
14
by: phil_gg04 | last post by:
Dear C++ Experts, Over the last couple of months I have been writing my first program using shared memory. It has been something of an "in-at-the-deep-end" experience, to say the least. At...
5
by: Stuart Robertson | last post by:
I am trying to find a solution that will allow me to use XmlSerializer to serialize/deserialize a collection of objects where a given object is shared between two or more other objects, and not...
1
by: Eduardo Azevedo | last post by:
If I have a class with method Shared, when this objects are destroies what's happend with the objects Shared? How long is the lifetime of a function shared in the Class ? there are no...
1
by: Henri | last post by:
Hi, I'm using a custom class in my ASP.NET which has a Shared property. I don't want this Shared property to be shared between users because of thread concurrent accesses problems. I just want it...
11
by: tshad | last post by:
I am setting up some of my functions in a class called MyFunctions. I am not clear as to the best time to set a function as Shared and when not to. For example, I have the following bit...
15
by: Rob Nicholson | last post by:
A consequence of the ASP.NET architecture on IIS has just hit home with a big thud. It's to do with shared variables. Consider a module like this: Public Module Functions Public GlobalName As...
14
by: Joe Fallon | last post by:
I am trying to build a Data Access Layer for a SQL Server back end. My class has a number of methods in it. The constructor takes a connection string. I currently have to instantiate an object...
5
by: Simon | last post by:
Hi all, We have an ASP.NET 1.1 application running on IIS6 on Server 2003. Most of the base objects we are using in this application are taken from a windows application also written by us. We...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...

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.