I'm trying to do something that might be crazy, and it might not work because
of information I don't know about.
I have written a Unicode-GLib that handles Unicode text display, as well as a
Unicode text-entry gadget, a Unicode list gadget, and a customizable Unicode
keyboard. I am interested in trying to convert this into a hack using YAHM
(since they found a way to hack PalmOS 5.0). However in looking into it, it
seems that they said that YAHM hacks can't interface with GLib or other kinds
of libraries.
What I did notice though is that with YAHM, every hacked function goes into its
own code segment. So I am trying to convert my whole library so that each
function goes into its own code segment.
When the program starts, I create a struct (call it codeStruct), and codeStruct
holds pointers to the locked location of every code segment. Thus I have a
pointer for each function in my "library". I also modify each function to take
codeStruct as a parameter, with the intent that it can then call any other
functions in the library just by using the pointer to the function's location
in memory.
I think I might be missing info about how the Palm actually switches from one
function to another though.
I can call a "library-function" from my application and it works OK, but if
that function then tries to call another "library-function", I get an
"Unhandled instr" error in the Simulator, or "UniTest just read from memory
location 0x00044A9A, causing a bus error...blah blah...accessed a memory
location that is not in RAM or ROM..." in the Emulator.
Is it possible for me to call functions just using their locked pointer in
memory? Or do I need to do some kind of assembly "magic"?
Currently I call a function like this:
[code]
//A struct that holds the pointer for each function's code segment
typedef struct
{
Err (*UniBucketOpenUnicode)(MemPtr uniCRP, UniBucketPtr uniBucketPtr, UInt8
foundVFS, DmVFSPathPtr pathList, UInt8 nbrPaths, UInt8 *foundUniCharDB, Boolean
*openMappingDB, Boolean *openKeyMapDB, Boolean *openKeyboardDB);
Err (*UniFontGetFontList)(MemPtr uniCRP, UniBucketPtr uniBucketPtr, Boolean
tryVFS, DmVFSPathPtr pathList, UInt8 nbrPaths);
} UniLibCodeResourceType, *UniLibCodeResourcePtr;
UniLibCodeResourcePtr uniCRP = functionThatLocksCodeResources();
//My application then successfully calls UniBucketOpenUnicode
(*uniCRP->UniBucketOpenUnicode)(uniCRP, ... other arguments ...)
//But the UniBucketOpenUnicode function fails to call this function
//instead it gives the Unhandled instr error
(*uniCRP->UniFontGetFontList)(uniCRP, ... other arguments ...)
[/code]
So, can anyone tell me whether what I am trying is possible, and if so, if
there is anything I'm doing wrong in calling functions, and what I should do
differently?
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/