Hi Eddie!
I'm definitely not a multi-segment guru but I'll try to help out.
I think you need to declare your functions with the __attribute__ ((section
("....")) goobers. From what I can tell from your sample code (and I could
easily be wrong), you used the __attribute__ goober on the extern
declaration but not also on the actual function itself.
I use multiple segments with PRC-Tools but I have just one .c file. (Bad
form, but it's done that way for historical reasons...) Consequently I
don't need anything declared extern. However, here is the beginning of one
of my functions:
------------------------------------
static Boolean isLongPress(
UInt16 ui16CtlID
) CFGVIEW_SECTION;
static Boolean isLongPress(
UInt16 ui16CtlID
)
{
/* guts of function code here */
}
------------------------------------
As per Lonnon Foster's suggestion, I have the following in my .h file:
------------------
#define CFGVIEW_SECTION __attribute__ ((section ("cfgview")))
-------------------
I also pretty much followed his other guidelines.
Following my example, if you want to call isLongPress() from another .c
file, you would need to set things up a little differently. Something like:
---------- file1.c ----------------
Boolean isLongPress(
UInt16 ui16CtlID
) CFGVIEW_SECTION;
Boolean isLongPress(
UInt16 ui16CtlID
)
{
/* guts of function code here */
}
------------------------------------
---------- file2.c ----------------
extern Boolean isLongPress(
UInt16 ui16CtlID
) CFGVIEW_SECTION;
Boolean someFunction(
UInt16 ui16CtlID
)
{
Boolean val;
val = isLongPress(25); // call extern function in CFGVIEW_SECTION
return(val);
}
------------------------------------
someFunction() performs nonsensically but shows the general principle.
Hope this helps.
Dennis Leas
-----------
[EMAIL PROTECTED]
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Eddie
Ludema
Sent: Tuesday, March 25, 2003 9:25 PM
To: Palm Developer Forum
Subject: Re: Multi-section apps / calling functions
I was thinking that the multi-segment gurus might be getting tired of the
repeated posts on the woes of multi-segmented code. Could somebody point me
to some good solid source code examples that implement multiple segments
using PRC-Tools? I'm sure I'm just missing something simple and have been
trying too hard to find a small problem. If I could get my hands on some
working code, it would be really helpful. I've already searched the
archives for this list, Palm's knowledge base, PRC-Tools documentation,
manuals for gcc/multigen/build-prc/etc as well as faqs on falch.net. I've
found lots of great stuff, but I'm still stuck with code not being able to
see functions in other segments ("undefined reference to '__text__foobar'"
or "undefined reference to '__text__'"), even though I have extern function
declarations where they need to be (I think...)
I don't want to waste anybody's time so any help at all would be greatly
appreciated!
Thanks again,
Eddie
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/