At 12:00am -0700 00-09-27, Palm Developer Forum digest wrote:
>Subject: Re: how to have multiple code resources in a shared library?
>From: "Rob Dugal" <[EMAIL PROTECTED]>
>Date: Tue, 26 Sep 2000 14:57:46 -0400
>X-Message-Number: 67
>
>OK, here's what I'd like to do. Create a second code resource within
>the shared
>library prc. The code in the 2nd code resource has no globals and is in fact
>just a wrapper around a set of functions in a static library. The
>entry point to
>this code resource will be a dispatcher routine which calls the
>other functions
>within this code resource. To call a function in the 2nd code resource I will
>get a handle to the 2nd code resource, lock it down, set some parameter data,
>and call the dispatcher function at the beginning of the 2nd code resource.
>This sounds pretty straightforward.
>
>The two problems I have is
>1) How do I get codewarrior to create the 2nd code resource within the shared
>library prc?
>The Palm article "Shared Libraries and Other Advanced Project Types" seems to
>indicate that this is possible by using multiple targets in the
>codewarrior IDE
>but I cannot figure out how exactly to do this.
From memory (OK, there are probably a few missing steps here)...
a. Create a new target in your project - let's say it's called "Plugin Code".
b. Set the project type (in the 68K Target panel) to be PalmOS Code
Resource, with the output file as "PluginCode.rsrc", and the resource
type as 'plug', id = 1000.
c. Make sure you set up the rest of the target to be for PalmOS (e.g.
PalmOS floating point, PC-relative strings, and so on).
d. Create a C source file with the routines that you'll be
dispatching to. Add this file to the new Plugin Code target.
e. Create a C source file with the dispatch table, and add this to
the Plugin Code target. Make sure it's first in the link order, and
the dispatch name is __Startup__.
f. Select the Plugin Code target and build it - when that works, you
should get a file called "PluginCode.rsrc".
g. Add this file to the device target for your shared library. Also
mark the Plugin Code project as a dependency for the shared library
target.
>2) How do I get the handle to the 2nd code resource?
>I think this would be obtained using DmGet1Resource(type, id) but because I
>can't figure out step 1 I'm unable to proceed.
You'd call DmGet1Resource('plug', 1000), then lock it down.
Hope this helps get you started...
-- Ken
Ken Krugler
TransPac Software, Inc.
<http://www.transpac.com>
+1 530-470-9200
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/