Hey Mayank,

> I'm supposed to port a C++ application from Windows to Palm. 

Ah well! One more windows app gets on palm. cool. :-)


> This application heavily uses standard C++ library functions 

Hmmm. So please be advised that other than new and delete, you would 
have to take care of the functions that your windows application uses 
and you wont find them in palm. For e.g. palm environment does not 
have the standard C library ( or at least not exposed to application 
developers ) so one should really be making use of the calls of the 
undelrying OS i.e. Palm for various functionalities. Thus, you would 
have to replace all the occurences of strcpy() with StrCopy() of 
String Manager ( or perhaps with some API from Text Manager if you 
plan to internationalise your app in the future )! 


> -  new and delete
> for memory allocation/deallocation . 

As per the C++ Standards, the new keyword is supposed to do _two_ 
things : 1. Allocate the memory for an object from the heap 2. Having 
allocated the memory, run the objects constructor on that allocated 
memory. 

If you plan to use MemPtrNew() and MemPtrFree() as the parallel calls 
for new and delete in your app, please rememebr that MemPtrNew() 
would allocate the memory for you, but it will _not_ call the 
constructor on that memory. 

AFAIK, the implementation of new keyowrd on Palm is such that it 
always calls the MemPtrNew() API of the Memory Manager 
internally...so you are really given a direct physical address by the 
system. Since this poiner is not locked, it may become a dangling 
pointer should the system run a "compaction" routine or other similar 
job behind your back. 

So, the wise thing to do would be to use the new only if you are sure 
you are not gonna need the object for longer periods of times. 

Guys, please correct me if I am wrong. 

Thanks.

-Viren

--- In [EMAIL PROTECTED], "Mayank Babu Rastogi, Noida" 
<[EMAIL PROTECTED]> wrote:
> Hi,
> 
> I'm supposed to port a C++ application from Windows to Palm. This
> application heavily uses standard C++ library functions -  new and 
delete
> for memory allocation/deallocation . As per my understanding, new 
and delete
> are not supported in Palm. What could be the best alternative to 
these
> library functions?
> 
> Thanks and regards,
> Mayank
> 
> -- 
> For information on using the Palm Developer Forums, or to 
unsubscribe, please see http://www.palmos.com/dev/support/forums/


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to