RE: Using fortran shared libraries from root

From: Fine, Valeri <fine_at_bnl.gov>
Date: Thu, 9 Feb 2006 23:42:38 -0500


You should describe the interface to your FORTRAN subroutine using C-like header file and create the RootCint dictionary for that interface. One is advised to create a C-wrapper around of the Fortran call and create the RootCint dictionary for that wrapper.  

MyFortran.h:



 void MyFunction( int a)  

MyFortarn.cxx:
extern "C" {
  void myRealFortran_(int *a);
}

void MyFunction(int a)
{
  int fA = a;
   // call the real fortran
   myRealFortran_(&fA);
}
   

The real life examples can be seen too:  

ttp://www.star.bnl.gov/cgi-bin/cvsweb.cgi/StRoot/St_base/StMessMgr.h?rev=1.7 <http://www.star.bnl.gov/cgi-bin/cvsweb.cgi/StRoot/St_base/StMessMgr.h?rev=1.7> http://www.star.bnl.gov/cgi-bin/cvsweb.cgi/StRoot/St_base/StMessMgr.cxx?rev=1.6  

Hope this helps.  

                    Valeri

________________________________

From: owner-roottalk_at_pcroot.cern.ch on behalf of Dimitri Bourilkov Sent: Thu 2/9/2006 3:10 PM
To: roottalk_at_pcroot.cern.ch
Subject: [ROOT] Using fortran shared libraries from root

Hi,

    I would like to call from the root command line functions/subroutines from a fortran shared library (.so) built with -fpic. Is this possible? I see in the root pages examples for calling cernlib, but as they are statically built one has to rebuild the root.exe. This is not what I want, I would like to make them accesible from the standard root prompt. Any advice is welcome.

    Best, Dimitri

--
        _/_/_/                             _/_/_/
       _/    _/   Dimitri  BOURILKOV      _/    _/
      _/    _/   University of Florida   _/_/_/
     _/    _/   bourilkov_at_phys.ufl.edu  _/    _/
    _/_/_/                             _/_/_/
Received on Fri Feb 10 2006 - 05:43:11 MET

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:31:57 MET