I have been experimenting with different methods of creating a plug-in
architecture and have run into some problems.
At present I am using the multiple code resource suggested by the palm
developer knowledge base "Shared Libraries and Other Advanced Project Types"
paper, Knowledge Base article 1052 ("How do I add a plug-in architecture to
my application?"), and the PlugIn-1 example.
The first problem I have run into is how to call functions in the plug-in,
other then the one at the first offset in the code resource database as
demonstrated by the PlugIn-1 example. I tackled this by having the function
at the first offset or __Startup__ function take a structure of function
pointers as a parameter. The function then points the function pointers to
the corresponding functions in the plug-in. After the __Startup__ function
ends, the calling application can call the functions in the function pointer
structure. Is there a cleaner / more elegant way of obtaining the plugin's
function offsets?
My second problem is a bit more challenging. My plug in needs to be able to
use the Palm's serial port. Therefore, I use the standard method of using
SysLibFind and opening the port. However, SysLibFind is erroring out and I
don't recieve the right reference number. When I hard code a 1 as the
libraray reference number everything works and I can send and recieve data
to my hearts content. In the process of locating the problem I tried to
post a message in the case that the SysLibFind function died like so:
ErrNonFatalDisplayIf((SysLibFind("Serial Library",
&libref)==sysErrLibNotFound),"Couldnt find it");
When the SysLibFind did indead fail to find the library, a message box was
posted. However, the message was unreadable and certanly not "Couldn't find
it".
I'm stumped at the moment as to the cause.
Does any one have any ideas?
Thanks,
Mike
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/