[Nelug] ld and unit testing in C

Oliver Burnett-Hall olly at burnett-hall.co.uk
Tue Sep 25 21:29:17 UTC 2007


On 25/09/07 12:57, Martin Ward wrote:
> gnm_app_prefs is a pointer, isn't it? Is it referenced in one of the functions
> you call from ranges.c? Have you tries creating a dummy definition
> for it (as a void pointer)?

You're right it is a pointer -- a global one, declared in one of the 
header files that gets #included from ranges.c.  It isn't used in any of 
the functions that get called, but it is used in some of the other 
functions in ranges.c; obviously this is still enough for the loader to 
error out.

Adding a global declaration of a variable of the same name in 
check_ranges.c is enough to get this to work -- I can now compile and 
execute the test program successfully.  [This was made simpler by the 
fact that the loader doesn't seem to do any type checking, which meant I 
could declare gmn_app_prefs as an int*, even though the code in ranges.c 
that use it accesses its struct members.]

Thanks for your help with this.  Now I've just got to work out how to 
get this all building with automake...

- olly






More information about the Nelug mailing list