Random CW 9.2 Notes
The CodeWarrior for Palm OS 9.2 update is posted! See the "CW Updates & Fixes" page for details and links to download this patch. It looks likely that we'll be updating the PACE Native Objects tools soon; alas, it takes releasing tools as final for people to actually report bugs. The compiler and linker are much better than 9.0, but they've also had eight months of work put into them between releases, so a lot has changed. I'll try to keep you updated of any workarounds.
PNOInlineNewDelete.h
I've just added a header file to the site. http://gems.palmoswerks.com:81/www/PNOInlineNewDelete.h is a new header file that you can use with the 9.2 PNO support to define inline versions of new and delete for use in C++ code. These versions don't throw exceptions and they don't follow the standard new_handler logic, so they aren't standard compliant, but they meet the general expectation of what new/delete should do.
BCTextUtils Plugin
I've posted a COM plugin for the CodeWarrior IDE that gives you several new editor commands:
You can download it and the CW for Windows 8.3 source at http://gems.palmoswerks.com:81/www/BCTextUtils20031002.zip. Just put the DLL in your CW installation's bin/plugins/COM folder, then restart the IDE. You'll now see the new commands in the "Commands & Key Bindings" dialog where you can map them to keystrokes.
This is NOT supported software; I did this to experiment with writing COM plugins for the IDE using ATL, but I've not done extensive testing.
Using Global Variables in 9.2 PACE Native Objects
With the 9.2 update, we now support using global variables in your
PACE Native Objects. The technique we're using partially works in V9,
but we didn't have any loader support for the technique, so it was
much harder to implement.
To see how this works, create a new project using the PACE Native
Object stationery. This shows you how the PNOLoader library is used
from your 68K application to allocate space for the global variables
and store that information where your app can access it.
The 68K code in the stationery that calls the PNO looks like this:
// call the PACE Native Object UInt32 processor; FtrGet(sysFtrCreator, sysFtrNumProcessorID, &processor);
if (sysFtrNumProcessorIsARM(processor))
{ PnoDescriptor pno;
MemHandle mh = DmGetResource('ARMC', 1); MemPtr pnoPtr = MemHandleLock(mh);
PnoLoad(&pno, pnoPtr); UInt32 result = PnoCall(&pno, 0); PnoUnload(&pno);
MemHandleUnlock(mh); DmReleaseResource(mh); }
The PnoDescriptor type holds information about the PACE Native Object
that is used to free the PNO and clean up it global area after use.
The loader code requires that you've already locked the PNO in
memory. If you have a PNO that is split into multiple resources using
the Palm OS 68K Linker's .sbin support, you'll have to reassemble the
PNO yourself to get it all in one contiguous chunk.
PnoLoad will allocate the memory for the global variable space using
information stored at the beginning of the PNO. The new
ARMlet_Runtime.a in 9.2 has startup code that is immediately followed
by a table of values, all populated by the PNO Linker.
PnoCall is used rather than PceNativeCall and uses the information
stored in the PnoDescriptor structure to call your code.
Finally, when you are done making calls to the PNO, you use PnoUnload
to free the global variable memory from the heap.
The code for the PNOLoader library is available in the CW for Palm OS
Support folder. Feel free to inspect it; a useful exercise would be
to expand it to support reassembling multiple-resource PNOs into a
feature pointer, with the global data only copied onto the heap and
not stored in feature memory. A stub for this functionality is
provided in the library in the form of PnoLoadFromResources, but the
reassembly code has not yet been implemented.

Send feedback to combee@techwood.org
Copyright © 2004 Benjamin L. Combee
Palm OS is a registered trademark of PalmSource, Inc.
Metrowerks and CodeWarrior are registered trademarks of Metrowerks Inc.
The views expressed on this website/weblog are those of mine alone and do not necessarily reflect the views of PalmSource or Metrowerks.

qwertYAK / frobnovich
|