On November 16, 2004 11:11 am, Andrew Comley wrote:
> Many thanks for the link, however can you spare the time to give the step
> by step sequence?
In MyFontLib (the Library):
1. Develop code, one (or more) function per file in Src, organized into
functional categories via subdirectories in Src. See SOURCES variable, line
13 of the Makefile. (Make will not use files more than one directory deeper
than Src. I.e. Src/Tools/Old/Tool.c will not be compiled.)
2. Develop resources inside Rsrc/Resources.rcp and other RCP files within that
directory. All RCP files will be compiled to produce the end GLib PRC.
3. Create Library.h which declares all exported functions. Global variables
may not be shared between Library and Client, however. Use access functions.
(You /can/ use globals within the library - unlike shared libraries.)
4. Create MyFontLib.def, listing within the export{} section each exported
function, one per line. Do not delete old lines or add lines to anything but
the end, otherwise you will break compatability with older versions. (PalmOS
uses this, as can be seen by the V2, and V5 versions of some functions in the
SDK.)
5. Compile using Make. This will produce libMyFontLib.a and MyFontLib.prc.
The PRC is the installable library, required for client applications to run.
The .a file is the developer library used to attach MyFontLib.prc to the
client application at runtime.
In LibTest (the Client):
1. Place an updated Library.h and libMyFontLib.a in the LibTest directory,
overwriting the old versions. These are the two files needed by each client
application at compile-time - and the only files needed. Once you link
against the library (-L. -lMyFontLib) you require not additional code to use
the functions within the library.
2. Develop code and resources for the client application.
3. Compile using Make - examine the Makefile in the LibTest directory. It is
similar to the library's makefile and relies heavily on default targets.
4. Load up the two PRCs into an Emulator or Simulator. Enjoy.
General Notes:
1. You'll likely want to register your own creator ID for the library and
application, not to mention rename the entire library. In the library, you
need to modify Rsrc/Resources.rcp lines 5-7, Makefile line 1, and line 1 of
MyFontLib.def. Then rename MyFontLib.def to whatever you entered on line 1
of the Makefile. Delete the .a and .prc files, and the library should
re-compile fine. For the client application, update line 1 and 7 of the
Makefile, and lines 5-7 of Rsrc/Resources.rcp. Delete the .a and .prc files
and copy the new .a file from the library directory, and the client
application should compile fine.
2. Use functions from the library in the client application as if they were
functions built right into your client application. The font example uses
FntLibraryStartup on line 10 of Application.c and FntLibraryShutdown on line
26 of same. They are defined in Library.h, with actual code in the library.
3. Try writing your functions completely within the application, first. Write
them in such a way as they do not rely on global variables presented in the
application (i.e. instead of using a global to store the current VFS volume,
pass it as the first argument). This will make debugging much, much easier,
as debugging (on PalmOS) libraries like this is damn near impossible. Only
when the functions work, perfectly, split them into a seperate library.
> I am using palmos4.0 which appears in all my succesful builds cygwin
> output.
For the broadest audiance, I do not specify a specific SDK version when
building. Try running palmos-dev-prep again to force it to set a default SDK
(usually the newest), then compile again. Or, you can add -palmos4 to the
CFLAGS varaible in the Makefiles. (I'd reccomend the first, as you shouldn't
need to specify a SDK version.)
I hope you get it to work with a minimum of difficulty,
Matthew Bevan
--
Matthew Bevan, Margin Software
- Re-inventing the wheel, every time.
Finagle's Tenth Law:
No matter what the result someone is always eager to misinterpret it.
--
For information on using the Palm Developer Forums, or to unsubscribe, please
see http://www.palmos.com/dev/support/forums/