From ripley at stats.ox.ac.uk  Tue Apr  4 12:03:41 2006
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Tue, 4 Apr 2006 11:03:41 +0100 (BST)
Subject: [Rd] Integration of C and Fortran
In-Reply-To: <p06230905c05711d5d338@[192.168.0.110]>
References: <p06230905c05711d5d338@[192.168.0.110]>
Message-ID: <Pine.LNX.4.64.0604041052090.3947@gannet.stats.ox.ac.uk>

Is

>        the enter point Fortran "orderdata_" absent of the loading table.

a manual translation, and was the underscore there in the original (I 
think it should be, but am just checking).

What do nm -g mpackage.so tell you is actually exported from the shared 
object (here called 'mypackage.so')?  I suspect that will reveal a 
mismatch of names.

On Mon, 3 Apr 2006, Sebastien Durand wrote:

> Dear all,
>
> I am running R : Copyright 2005,
> Version 2.2.1  (2005-12-20 r36812)
> ISBN 3-900051-07-0
> On a mac 10.4.5
>
> I am having trouble with my package.
>
> The trouble is the following:
>
> In my package I have integrated three files in my src folder.
> 1- simplematch.C a .C file
> 2- ordering.f a fortran file
> 3- Makevars :  PKG_LIBS =  $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
> I am not sure if that last file is really useful!?
>
> When I use the R CMD SHLIB command on both these
> source code files, the resulting compiled  .so
> files when loads fine with the dyn.load function.
> At last when I use either the
> .C("simplematch",...) and
> .Fortran("ordering",...) command everything
> works...
>
> Now here comes trouble:
>
> When I do the R CMD INSTALL command, my package install.
> The .C command works but when I run the .Fortran command I get:
>
> Error in .Fortran("orderdata", d = as.double(d),
> as.integer(n), rowscore = as.double(rowscore)) :
> 	the enter point Fortran "orderdata_" absent of the loading table.
>
> What should I do to make sure that upon the installation of my package my
> Fortran function will appear in the load table...
>
> Thanks a lot.
>
> S?bastien Durand
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


[Rd] Integration of C and Fortran
Prof Brian Ripley