"Mike Shubeck" <[EMAIL PROTECTED]> wrote in message
news:74665@palm-dev-forum...
>
> 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?

You could always use Palm's shared library mechanism, which does
something very similar, except the details of function dispatch are
hidden from the user.

> 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".

My guess is that its failing because SysLibFind isn't actually being
passed the right string.  Since code resources have no data segments,
you need to make sure your string "Serial Library" is stored in the code
segment.  To do that in CodeWarrior, go to the 68K Processor panel for
the code resource and make sure "PC-Relative Strings" is turned on.



-- 
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