Amiga.org

Operating System Specific Discussions => Amiga OS => Amiga OS -- Development => Topic started by: Minuous on March 19, 2012, 11:22:14 PM

Title: Linker issues when making BOOPSI gadget
Post by: Minuous on March 19, 2012, 11:22:14 PM
Hello all,

I'm in the process of developing a piechart.gadget for ReAction. The only example code I have found is the led.image code from the Developer CD. I'm trying to adapt that code but it doesn't seem to want to link correctly with SAS/C.

In the piechart.c file, there is a prototype:

VOID CallCHook(void);

and it is referred to later on this line:

cl->cl_Dispatcher.h_Entry = (HOOKFUNC) CallCHook;

In classinit.asm, I have:

    XDEF @CallCHook

and later in that file:

@CallCHook:
    ...code here...

and I am linking like this:

slink FROM classinit.o piechart.o endcode.o LIBRARY LIB:amiga.lib LIB:debug.lib TO piechart.gadget

but SLink refuses to link it, saying that _CallCHook is undefined. I don't know why. I don't know the significance of the prepended @ and _, it is not explained anywhere what these mean. I have tried changing, removing etc. these prepended symbols but it seems not to help.
Title: Re: Linker issues when making BOOPSI gadget
Post by: Steady on March 20, 2012, 01:58:18 AM
I'm not sure what assembler you are using, but C prepends all functions with an underscore, so XDEF _CallCHook should work fine.

Define the function as:

_CallCHook:
   ... code here ...

Is that still an issue?
Title: Re: Linker issues when making BOOPSI gadget
Post by: Minuous on March 20, 2012, 05:15:21 AM
Yes, the assembler in use is the SAS/C assembler.
  Hmm, yes that is linking OK now. I thought I had tried that already, apparently not. Thanks.