Compiling problems

Hi,
I'm trying to make some kind of Material editor, which will be used to preview materials in the early phase of design, before the final scene is composed. For that purpose I need to parse text file with material descriptions, to find out which materials are defined.

My idea is to use some of existing Radiance functions for parsing. I found that void readobj(char*) [readobj.c] could be useful for this. And finally there is a question:

Example of a code:
file: parser.c

···

------------------
#include "standard.h"
#include "object.h"

void parse(char* name)
{
   readobj(name);
}

file: makefile
--------------------
RAD=/home/marija/ray/src/common
LRAD==/home/marija/ray/src/lib
CCOPTS=-O

parser: parser.c
cc $(CCOPTS) -I$(RAD) -o parser parser.c -L$(LRAD) -lrt -lm
_____________________________________________
When I try to make it, I get next error massages:

cc -O -I/home/marija/ray/src/common -o parser parser.c -L=/home/marija/ray/src/lib -lrt -lm
/home/marija/ray/src/lib/librt.a(otypes.o)(.text+0x17): In function `otype':
: undefined reference to `ofun'
/home/marija/ray/src/lib/librt.a(otypes.o)(.text+0x61): In function `objerror':
: undefined reference to `ofun'
/home/marija/ray/src/lib/librt.a(modobject.o)(.text+0xb9): In function `lastmod':
: undefined reference to `ofun'
/home/marija/ray/src/lib/librt.a(modobject.o)(.text+0x144): In function `insertobject':
: undefined reference to `ofun'
/home/marija/ray/src/lib/librt.a(readoct.o)(.text+0x55e): In function `nonsurfinset':
: undefined reference to `ofun'
/home/marija/ray/src/lib/librt.a(mesh.o)(.text+0xe64): more undefined references to `ofun' follow
collect2: ld returned 1 exit status
make: *** [parser] Error 1

___________________________________________________________________
My first idea was that I am doing something wrong, but when I tried to call some other functions that don't use "ofun" table, program is compiled without problems.

Could somebody, please, tell me what is the problem here, because I am trying to solve it for a week, without results.

Regards,
Marija.

Hi Marija,

the Radiance library librt.a apparently cannot be used as standalone module. It needs the separate ofun table. The reason is probably this: if you produce oconv, the ofun table gets assigned the 'inclusion' functions which check if an object intersects an octree subcube. If you compile rpict or rvu, the ofun table gets assigned the ray-object intersection functions.

So if you don't need either of those, simply remove all references to the ofun table from your parser code files. The other way would be including it (no matter of you need it or not), then you have to look out for the files which define it (one is e.g. initotypes.c in src/rt), but then in turn you have to include the whole set of functions, too, and you'll end up in compiling almost all of the complete rpict...

No matter which way you take, be aware that modifying the Radiance code brings you right into the devil's boiling pot...

But don't give up, there's always a solution..

-cb

PS: if you've further questions, I'd offer to continue this discussion off-list