putting functions, not classes, in a sharled lib

Chris Jillings (chris@owl.phy.queensu.ca)
Mon, 28 Sep 1998 17:47:52 -0400 (EDT)


Hello,
I tried to make a shared library with one function in it. I was able
to build the shared lib with no errors and load it into root. I just could
not execute the function in the interpreter.

This is the root interpreter interaction. The .h, .C and a snippet of the
Makefile are below.

Thank you in advance for your help.

Chris

root [0] gSystem->Load("libcuber.so");
root [1] Double_t x,y;
root [2] x =5.0;
root [3] y = cuber(x);
Error: No symbol null in current scope FILE:/tmp/09951daa LINE:1
root [4]

The cuber.h file was

#ifndef __CUBER_H
#define __CUBER_H
#include "Rtypes.h"

Double_t cuber(Double_t x);

#endif

The cuber.C file was

#include "Rtypes.h"
Double_t cuber(Double_t x) {
Double_t retvar = x*x*x;
return retvar;

}

I made everything with the usual procedure

cuberdict.C: cuber.C cuber.h
echo "generating cuber dictionary"
rootcint cuberdict.C -c $(INCLUDE) $(ROOTOBJ) cuber.h

cuberdict.o: cuberdict.C
$(CXX) -c $(CXXFLAGS) cuberdict.C

cuber.o: cuber.C cuber.h Makefile
$(CXX) -c $(CXXFLAGS) $(ROOTOBJ) cuber.C

libcuber: cuber.o cuberdict.o
$(LD) $(LDFLAGS) $(SOFLAGS) cuber.o cuberdict.o $(GLIBS) \
-o libcuber.so

The Makefile definitions were unchanged since successfully putting classes
into a shareled lib.

=================================================================
= =
= Chris Jillings =
= Department of Physics phone/voice mail: (613) 545-6000x4805 =
= Queen's University fax: (613) 545-6813 =
= Kingston, Ontario email: chris@sno.phy.queensu.ca =
= Canada, K7L 3N6 web: http://sno.phy.queensu.ca =
= =
=================================================================