[ECOS] Can I use the dynamic memory allocation on the class object? Thanks a lot.
QiangHuang
jameshq@liverpool.ac.uk
Tue Apr 29 17:57:00 GMT 2003
Thank you very much for your help.
Maybe I was not doing in the right way. The problem is I can use new to
create a class object when building the eCOS library. but when linking with
my application I got the following error:
warning: no memory region specified for section `.eh_frame'
section .eh_frame [00092508 -> 00092d8f] overlaps section .text [00040040 ->
00093287].
but this can be done with malloc() without problem.
Maybe I have missed something. Thanks a lot.
BTW can I do it by the replacement new as:
cyg_uint8 *pbuf = malloc( sizeof(my_class) );
my_class *pclass = new(pbuf) my_class;? // will the class constructor be
called here?
Thanks a lot.
-----Original Message-----
From: Schumacher, Gordon [mailto:gordon_schumacher@maxtor.com]
Sent: 29 April 2003 18:15
To: 'QiangHuang'; Ecos-Discuss
Subject: RE: [ECOS] Can I use the dynamic memory allocation on the class
object? Thanks a lot.
Is there something obvious that I'm missing - is there a reason you're not
using the following?
my_class *pclass = new my_class;
If I'm not dreadfully mistaken, that's dynamic allocation...
# -----Original Message-----
# From: QiangHuang [mailto:jameshq@liverpool.ac.uk]
# Sent: Tuesday, April 29, 2003 11:07 AM
# To: Ecos-Discuss
# Subject: [ECOS] Can I use the dynamic memory allocation on the class
# object? Thanks a lot.
#
#
# Hi all:
# I would like to use the dynamic memory allocation on the Class object
# creation, but how is its associated class constructor called?
#
# foe example:
#
# class my_class
#
# public:
# int a
# my_class() { a=100;}
# ~my_class(){};
# }
#
#
# my_class *pclass = malloc(sizeof(my_class));
#
# // by now has the my_class constructor been called?, or
# should I call it by myself?
# // I have tried the following: (I guess only the global class
# object constructor will be called when system started)
#
# pclass->my_class(); // error
#
# // or must I set it by
# pclass->a=100;
#
# thanks a lot.
#
#
# --
# Before posting, please read the FAQ:
http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss
More information about the Ecos-discuss
mailing list