public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Memory conflict between C and C++ programs
@ 2002-04-22  4:57 Priyadarshini K
  2002-04-22  7:15 ` Carlo Wood
  2002-04-22 11:22 ` mike stump
  0 siblings, 2 replies; 3+ messages in thread
From: Priyadarshini K @ 2002-04-22  4:57 UTC (permalink / raw)
  To: gcc

Hi
   This is an overview of the problem we are facing with integrating C and
C++ object code to form an executable. The environment details are as
follows:

   OS : Hardhat Linux 2.0
   Compiler : ppc_8xx-gcc
   Linker : ppc_8xx-ld

   We had to integrate the modem software given to us (C++ object files as
an archive) with our protocol stack (C files).

   We faced the following problems during the integration and testing of the
same:

   1) The global memory area assigned to the C++ programs and the C programs
are clashing.
      We have compiled both the C++ programs and C programs with the -Ur
flags, so they are relocatable.

   2) The global constructors are called before the main() function (which
is in a C file) is called. So if we try to initialize the OS before the
global constructors try to use any OS services, the memory areas conflict
and the global constructors data members are getting corrupted (pointers
become NULL), consequently leading to a crash.

   3) Are there any options to define separate memory areas for the C++ and
C programs to use?

   4) Are there any options which have to be used when working with C and
C++ files, as we are doing?

   5) The global constructors are using member functions of other objects.
Some of the crashes may be due to the fact that the member functions called
may not belong to an already initialized object. Should the objects, as a
rule, be created on first access to any of their member functions?

   Can anyone help us resolve these issues?

   Thanks in advance for any help.
   Priya


***************************************************************************
This message is proprietary to Future Software Limited (FSL) 
and is intended solely for the use of the individual to whom it
is addressed. It may contain  privileged or confidential information 
and should not be circulated or used for any purpose other than for 
what it is intended. 

If you have received this message in error, please notify the
originator immediately. If you are not the intended recipient,
you are notified that you are strictly prohibited from using,
copying, altering, or disclosing the contents of this message. 
FSL accepts no responsibility for loss or damage arising from 
the use of the information transmitted by this email including
damage from virus.
***************************************************************************

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Memory conflict between C and C++ programs
  2002-04-22  4:57 Memory conflict between C and C++ programs Priyadarshini K
@ 2002-04-22  7:15 ` Carlo Wood
  2002-04-22 11:22 ` mike stump
  1 sibling, 0 replies; 3+ messages in thread
From: Carlo Wood @ 2002-04-22  7:15 UTC (permalink / raw)
  To: Priyadarshini K; +Cc: gcc

On Mon, Apr 22, 2002 at 04:38:47PM +0530, Priyadarshini K wrote:
>    5) The global constructors are using member functions of other objects.
> Some of the crashes may be due to the fact that the member functions called
> may not belong to an already initialized object. Should the objects, as a
> rule, be created on first access to any of their member functions?
> 
>    Can anyone help us resolve these issues?

This is an FAQ question.  The problem you are having are
very probably not related to the compiler and therefore
this question doesn't belong on this list.

See http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.11
for more info.

-- 
Carlo Wood <carlo@alinoe.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Memory conflict between C and C++ programs
  2002-04-22  4:57 Memory conflict between C and C++ programs Priyadarshini K
  2002-04-22  7:15 ` Carlo Wood
@ 2002-04-22 11:22 ` mike stump
  1 sibling, 0 replies; 3+ messages in thread
From: mike stump @ 2002-04-22 11:22 UTC (permalink / raw)
  To: gcc, priyadk

This is the wrong list for this discussion.  gcc-help is more
appropriate.

> From: "Priyadarshini K" <priyadk@future.futsoft.com>
> To: <gcc@gcc.gnu.org>
> Date: Mon, 22 Apr 2002 16:38:47 +0530

>    This is an overview of the problem we are facing with integrating C and
> C++ object code to form an executable. The environment details are as
> follows:

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-04-22 18:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-22  4:57 Memory conflict between C and C++ programs Priyadarshini K
2002-04-22  7:15 ` Carlo Wood
2002-04-22 11:22 ` mike stump

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 read-only IMAP folder(s) and NNTP newsgroup(s).