Help understanding Dictionary

Hi,

In my quest to understand dictionary generation using CINT, I’ve been playing around with the standard EVENT example in $ROOTSYS/test.

I have the following situation. I would like to add a utility.h and utility.cxx to Event.cxx and Event.h where utility might contain very simple functions e.g.,

float multiply(float,float);
float sayHelloWorld();

My question is how to modify the EventLinkDef.h and Event.cxx so that the simple routines get picked up by CINT.

I tried adding the following lines to EventLinkDef.h but to no avail.
#pragma link C++ function sayHelloWorld;
#pragma link C++ function multiply;

During compilation I get the following error messages:

c++ -O2 -pipe -Wall -W -Woverloaded-virtual -D_REENTRANT -I/usr/local/root_v5.18.00/include -c Event.cxx
Generating dictionary EventDict.cxx…
c++ -O2 -pipe -Wall -W -Woverloaded-virtual -D_REENTRANT -I/usr/local/root_v5.18.00/include -c EventDict.cxx
MACOSX_DEPLOYMENT_TARGET=10.4 c++ -dynamiclib -single_module -undefined dynamic_lookup Event.o EventDict.o -o libEvent.dylib
ln -sf libEvent.dylib libEvent.so
c++ -O2 -pipe -Wall -W -Woverloaded-virtual -D_REENTRANT -I/usr/local/root_v5.18.00/include -c MainEvent.cxx
MACOSX_DEPLOYMENT_TARGET=10.4 c++ -O2 -bind_at_load MainEvent.o /private/var/automount/Volumes/Xraid1/Users/erdos/Dev_event/libEvent.dylib -L/usr/local/root_v5.18.00/lib -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lfreetype -lpthread -lm -ldl -o Event
/usr/bin/ld: Undefined symbols:
sayHelloWorld()
multiply(float, float)
collect2: ld returned 1 exit status
make: *** [Event] Error 1

Thanks for your help
Erdos
gcc 4.0.1
ROOT 5.18
mac osx 10.4

PS I am attaching my attempt thus far (not much really!!)
EV_HELP.tar.gz (10.6 KB)

Hi,

you need to compile and link your code (i.e. utility.cxx).

Cheers, Axel.