Sounds like fun!   ;-)

But seriously, I am using a technique I found in a presentation from 
PalmSource 2000 (page 14 of 
http://www.ardiri.com/publications/palmsource2000.pdf to be exact), but 
have run into one slight snag.

I'm using prc-tools 2.0.92 to compile an "application" with no startup code 
(-nostartfiles). I am then dynamically loading that app's code 1 resource 
by just locking down the resource, then calling the function that I require 
be the first function in the app. For grins I also reverse-engineered the 
way PalmOS currently generates its globals area from a data resource and 
gave the app its own globals, but I think I'm going to throw that 
non-upwards-compatible hack away and handle "globals" by passing around a 
reference to a globals block.

But I digress. Everything works great unless there are global initialized 
strings in the app, or unless the app uses hard-coded strings in that first 
function in the app. In either case, I end up with a code 1 resource that 
starts with a series of null-terminated strings (the initialized globals 
and/or hard-coded locals), followed by a word-aligned normal code start. 
Needless to say, when I use the address of the beginning of the code 1 
resource as the address of my function and call it, all hell breaks loose.

I notice that when I build John Marshall's Gauss syslib example and throw 
an initialized global string in it, it begins the code 1 resource with (in 
hex): 60 XX <string data> <code>, where XX gives the offset from the start 
of the string data to the start of real code. I'm assuming in my 68k 
ignorance that this is a branch or jump instruction to jump around the 
string data.

What I'm wondering is how I can get the same effect. I don't know what part 
of the prc-tools chain is generating that initial instruction; I'm 
certainly not getting it when I compile. My options seem to be:

a) Find out how to generate this [presumed] jump instruction.
b) Figure out how to find the start of real code in the code 1 resource 
with 100% accuracy.
c) Forbid global initialized string data, and forbid hard-coded strings in 
the first function in the apps that third parties will be writing.


Curtis Jackson
Director of Engineering
Aniwhere, Inc.
[EMAIL PROTECTED]



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

Reply via email to