At 03:49 PM 9/20/2002 -0400, you wrote:
>Hi,
>
>I can't use SysGetTrapAddress() to get a library function can I?
>For example:
>
>typedef Err (*myVFSFileOpen)(UInt16 volRefNum, const Char *pathNameP,
> UInt16 openMode, FileRef *fileRefP);
>{
>myVFSFileOpen func;
>
>func = SysGetTrapAddress(vfsTrapFileOpen);
>
>err = func(volref, "/palm/test.text", readonly, &ref);
>}
>
>When func is called I got an fatal exception with unimplemented error.
>Could func be pointing Somewhere else?
>
>What I'm trying to do is call the original library function in my library.
>I have replaced the system library. Can you call the original library
>within your our library?
First, you need to check the return value from SysGetTrapAddress and
compare it to the value of
SysGetTrapAddress(sysTrapSysUnimplemented). Traps that aren't implemented
on a device will have their address set to this so their use will be caught
at runtime.
If you want to work on Palm OS 3.0 or earlier devices, you need to call
SysGlueGetTrapAddress instead, as explained in the Palm OS SDK reference docs.
Note: in your case, this won't work, because vfsTrapFileOpen isn't a core
trap. You need to use sysTrapVFSMgr as your trap number, and then make
selector calls using this trap, as noted in the macros in VFSMgr.h... look
at how VFSMGR_TRAP is implemented in that file.
--
Ben Combee <[EMAIL PROTECTED]>
CodeWarrior for Palm OS technical lead
Palm OS programming help @ www.palmoswerks.com
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/