Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

My Development envirments: Windows XP, ADS 1.0.1, BREW SDK 1.0.2(version for Korean)

I`m developing a BREW application using C++

I overloaded class member operators like following (in class Declaration codes)

void *operator new(size_t dwSize)
{
return MALLOC(dwSize);

void operator delete(void *po)
{
FREE(po);

void *operator new [] (size_t dwSize)
{
return MALLOC(dwSize);

void operator delete [] (void *po)
{
FREE(po);

When I use new[] and delete[] for object allocation/deallocation ex) AClass *obj = new AClass[10];, I get the following message

Error: L6265E: Non-RWPI Section new_hand.o(.bss) cannot be assigned to PI Exec region ER_ZI.
Error: L6265E: Non-RWPI Section libspace.o(x$bss) cannot be assigned to PI Exec region ER_ZI.

But When I only use new and delete, I get no error message.

What should I do to correct that?

Does AClass have a default constructor?

Does AClass have a default constructor?

Yes, It has both default constructor and destructor.
declaration of AClass is similar to following
class AClass
{
private:
AECHAR *aField;
public:
AClass()
(
aField = NULL;
}
~AClass()
{
FREE(aField);
}
void *operator new(size_t dwSize)
{
return MALLOC(dwSize);
}
void operator delete(void *po)
{
FREE(po);
}
void *operator new [] (size_t dwSize)
{
return MALLOC(dwSize);
}
void operator delete [] (void *po)
{
FREE(po);
}

Yes, It has both default constructor and destructor.
declaration of AClass is similar to following
class AClass
{
private:
AECHAR *aField;
public:
AClass()
(
aField = NULL;
}
~AClass()
{
FREE(aField);
}
void *operator new(size_t dwSize)
{
return MALLOC(dwSize);
}
void operator delete(void *po)
{
FREE(po);
}
void *operator new [] (size_t dwSize)
{
return MALLOC(dwSize);
}
void operator delete [] (void *po)
{
FREE(po);
}

I don't see the key word public: anywhere. That's probably just an oversight? Make sure the constructor, destructor, etc. are visible.

I don't see the key word public: anywhere. That's probably just an oversight? Make sure the constructor, destructor, etc. are visible.

This is an error reported by the memory lib - see for example this thread:
http://brewlists.qualcomm.com/pipermail/brew-developers/2001-September/0...
Might happen because you've overwritten new[]/delete[] at class and not global scope (and you use new[] for something else than AClass)
Short example:
AClass** t = new AClass*[10];
t[0] = new AClass(param..);
t[1] = new AClass(param...);
uses the global new[] and not AClass new[]
hope this helps
Radu

This is an error reported by the memory lib - see for example this thread:
http://brewlists.qualcomm.com/pipermail/brew-developers/2001-September/0...
Might happen because you've overwritten new[]/delete[] at class and not global scope (and you use new[] for something else than AClass)
Short example:
AClass** t = new AClass*[10];
t[0] = new AClass(param..);
t[1] = new AClass(param...);
uses the global new[] and not AClass new[]
hope this helps
Radu

I haven`t used global new[] explicitly.
My code is similar to following
AClass *aObject = new AClass[10]; // default constructor is used
// Manipulations
delete[] aObject;
I presume that arm compiler 1.0.1 doesn`t support overloading of operator new [] and operator delete [].
As I know, some C++ compilers that don`t support overloading of operator new[] and operator delete[] uses global operator new[] and operator delete[] for every new[] and delete[].
Isn`t it? Does arm compiler 1.0.1 supports that?
If not, Does arm compiler 1.1 or more supports that?
And could I get some documents about C++ compatibility of arm compilers?

I haven`t used global new[] explicitly.
My code is similar to following
AClass *aObject = new AClass[10]; // default constructor is used
// Manipulations
delete[] aObject;
I presume that arm compiler 1.0.1 doesn`t support overloading of operator new [] and operator delete [].
As I know, some C++ compilers that don`t support overloading of operator new[] and operator delete[] uses global operator new[] and operator delete[] for every new[] and delete[].
Isn`t it? Does arm compiler 1.0.1 supports that?
If not, Does arm compiler 1.1 or more supports that?
And could I get some documents about C++ compatibility of arm compilers?

theres some docs on the arm.com site ads section support FAQ

theres some docs on the arm.com site ads section support FAQ

I`ve got ADS evaluation version 1.2
and I retried above codes.
The result was different.
(I modified the makefile ZA = -za1 -> -zo)
When I compile with ADS 1.2, there was no error messages.
but
Execution Region ER_ZI (Base: 0x0000c494, Size: 0x00000060, Max: 0xffffffff, ABSOLUTE)
Base Addr Size Type Attr Idx E Section Name Object
0x0000c494 0x00000060 Zero RW 271 .bss libspace.o(c_t__un.l)
remains.
Even when I omit operator new and operator delete, There was no error messages also.
Is my ADS 1.2 configuration wrong?
Is BREW supports operator new [] and operator delete [] really?

I`ve got ADS evaluation version 1.2
and I retried above codes.
The result was different.
(I modified the makefile ZA = -za1 -> -zo)
When I compile with ADS 1.2, there was no error messages.
but
Execution Region ER_ZI (Base: 0x0000c494, Size: 0x00000060, Max: 0xffffffff, ABSOLUTE)
Base Addr Size Type Attr Idx E Section Name Object
0x0000c494 0x00000060 Zero RW 271 .bss libspace.o(c_t__un.l)
remains.
Even when I omit operator new and operator delete, There was no error messages also.
Is my ADS 1.2 configuration wrong?
Is BREW supports operator new [] and operator delete [] really?

As my test, new[], delete[] works only if neither constructor and destructor exist. I tested in both ADS 1.0.1 and ADS 1.2
I think that it`s not a bug. I think that it`s a feature of BREW.
Isn`t it?

As my test, new[], delete[] works only if neither constructor and destructor exist. I tested in both ADS 1.0.1 and ADS 1.2
I think that it`s not a bug. I think that it`s a feature of BREW.
Isn`t it?

I got this weird error today and finaly I traced it to some code like this:
void func(int x) {}
.....
{
float x = 1.0;
func(x);

On the other hand if I write func(1.0); instead of passing variable it compiles fine. It might be that compiler automatically casts the float literal to int, but I'm not sure.
Also if I make calculations with the float it's ok as long as I don't assign to int. (now as I think the compiler probably optimizes them away as well)
So the final question is: does ARM support floating point? And if no, how is this error message related to the problem?
cheers,
Dimiter

I got this weird error today and finaly I traced it to some code like this:
void func(int x) {}
.....
{
float x = 1.0;
func(x);

On the other hand if I write func(1.0); instead of passing variable it compiles fine. It might be that compiler automatically casts the float literal to int, but I'm not sure.
Also if I make calculations with the float it's ok as long as I don't assign to int. (now as I think the compiler probably optimizes them away as well)
So the final question is: does ARM support floating point? And if no, how is this error message related to the problem?
cheers,
Dimiter

thats normal behaviour, the compilers optimizing out the code, it wouldn't pass a float to a funciton expecting int
on arm chips without floating point hardware, its all software emulated its upto the compiler and libs supplied to handle that properly, with brew its a partial emulation

thats normal behaviour, the compilers optimizing out the code, it wouldn't pass a float to a funciton expecting int
on arm chips without floating point hardware, its all software emulated its upto the compiler and libs supplied to handle that properly, with brew its a partial emulation