but I am still having problems. I have compiled PropMu into a shared library, libPROP_MU.so, and I wrote a very simple macro TestPropmu.C that just calls the function PROP_MU and outputs a range. I use the macro RunTestPropmu.C to load the library and call the macro. I have tried calling the function both with and without the trailing underscore (PROP_MU_ ), neither work. I have attached my code and shared library, as well as the Makefile that I used to create the shared library from the PROPMU source. Thanks for any help you can provide.
-eric
The errors I get are thus:
dlopen error: /home/hep/grashorn/minos/AstroNu/CompPropmu/./TestPropmu_C.so: undefined symbol: PROP_MU_
Load Error: Failed to load Dynamic link library /home/hep/grashorn/minos/AstroNu/CompPropmu/./TestPropmu_C.so
/home/hep/grashorn/minos/AstroNu/CompPropmu/./fileVE6xW6.o(.text+0x175): In function TestPropmu()': : undefined reference toPROP_MU_’
/home/hep/grashorn/minos/AstroNu/CompPropmu/./fileVE6xW6.o(.text+0x349): In function G__fileVE6xW6__5_124(G__value*, char const*, G__param*, int)': : undefined reference toPROP_MU_’
/home/hep/grashorn/minos/AstroNu/CompPropmu/./libPROP_MU.so: undefined reference to polint_' /home/hep/grashorn/minos/AstroNu/CompPropmu/./libPROP_MU.so: undefined reference toranlux_’
/home/hep/grashorn/minos/AstroNu/CompPropmu/./libPROP_MU.so: undefined reference to `locate_’ PropMuProblem.tar.gz (100 KB)
Makefile does not make much sense.
did you even try to compile it as it is ?
A guess: you have gfortran also installed on your system?
I had similar issues when I had some libraies ( or object files ) compiled with g77 and some with gfortran
At compile time they lived happily but at the link time they wanted divorce because they each wanted their own libraries.
What i did was: I left only one of them alive ( gfortran) and uninstalled g77 completely. Old cernlib installation complained a little and I replaced it with gfortran compiled one. Luckily Fedora supplies one as rpm.
This way no more troubles.
Best of all - use root Makefiles as THE example/template.
They ( respectable ROOT team) have done it all.
gfortran all over and appropriate libraries are linked were needed.
Thanks for your replies, they did inspire me to dig deeper. I am not positive, but I think that my shared library wasn’t created correctly, it just complied without complaint. So, I have dug up the libpropmu.a static library from the SuperK sofware release and written a Makefile that uses Makefile.arch and compiles and links TestPropmu.cxx with libpropmu.a, but there are many undefined symbols. I’ve attached the relevant files, and I am using ROOT version 5.12.00f I can’t make sense out of them. Any ideas how to get around this? Any suggestions on where to look next? Has anyone actually used propmu in ROOT? Thanks a lot for any help that you can provide.
I’ve used statically linked Fortran libraries so far. Did you declare the global C prototypes corresponding to the Fortran subroutine you want to call?
In your C++ code:
Do not use capital letters since the Fortran/C translator everything puts in lower case. Also, remember that parameters in Fortran are given by reference. Eg
When mixing Fortran and C in an executable you have to link g2c by
In order to access Fortran common block contents you have to map them to C structures. I use the Fortran->C translator f2c for doing this with the help of a little script called inc2h:
[code]#!/bin/sh
See ‘inc2h -h’ for documentation
if [ “$1” = “-help” -o “$1” = “-h” -o “$1” = “–help” ]; then
cat <<!!!
Script for converting Fortran include files
into C header files with the help of f2c
\$1 = Fortran include file
\$2 = Option string for f2c
Example:
inc2h myheader.inc > myheader.h
!!!
exit 0
fi
(cat $1; echo " END") | f2c -C++ “$2” | sed ‘/Main program/,/MAIN__/d’ | sed s/real/float/g > /dev/stdout[/code]