DeaR mac users
I tried to compile the fortran code of the "splancs" package using
Absoft's Fortran compiler f77 and combine the object files into a
shared library using Absoft's lnk. I could create the library without
any problem but
when I tried to access the library from R strange things happen.
I can load the modules contained in the library by the R's dyn.load().
But when I check whether a particular Fortran routine, say "areapl",
is accessible to R by using
is.loaded(symbol.For("areapl"))
[1] FALSE
Strange enough if I test
is.loaded(symbol.C("areapl"))
[1] TRUE
I get the answer that areapl is accessible as a C module.
From this I conclude that lnk gives the shared library some attribute
which makes R think that the library contains C code.
For contributed packages containing C code I did not experience any
problems, ie. acc and lnk created a shared library accessible to R
(e.g. I could install geoR, available from
http://www.maths.lancs.ac.uk/~ribeiro/geoR.html, on my G4).
Now my question is: how can I control that lnk creates a shared
library consisting of FORTRAN routines. Does anybody have a hint?
Andreas
For MPW/Absoft users I include the contents of the make file
### MAKEFILE PREAMBLE ###
TargetName = splancsLib
Makefile = # "{TargetName}".make
ObjDir_ppc = :
# Power Macintosh tools and default settings
f77_ppc = "{AbsoftTools}f77" -c
f77_ppc_opts =
# Object and resource files used for this build:
PPC_LIBS = Â
"{AbsoftLibraries}libf90math.o" Â
"{AbsoftLibraries}libfio" Â
"{AbsoftLibraries}libfmath"
PPC_OBJECTS = Â
"{ObjDir_ppc}areapl.o" Â
"{ObjDir_ppc}cncvwt.o" Â
"{ObjDir_ppc}dokhat.o" Â
"{ObjDir_ppc}inpip.o" Â
"{ObjDir_ppc}ipippa.o" Â
"{ObjDir_ppc}iplace.o" Â
"{ObjDir_ppc}k12hat.o" Â
"{ObjDir_ppc}kernel3d.o" Â
"{ObjDir_ppc}khvc.o" Â
"{ObjDir_ppc}khvmat.o" Â
"{ObjDir_ppc}krnnrm.o" Â
"{ObjDir_ppc}krnqne.o" Â
"{ObjDir_ppc}krnqrt.o" Â
"{ObjDir_ppc}nndist.o" Â
"{ObjDir_ppc}plarea.o" Â
"{ObjDir_ppc}sekhat.o" Â
"{ObjDir_ppc}sort.o" Â
"{ObjDir_ppc}sort2.o" Â
"{ObjDir_ppc}stkhat.o" Â
"{ObjDir_ppc}stsecal.o" Â
"{ObjDir_ppc}tribble.o" Â
"{ObjDir_ppc}twodimmse.o" Â
"{ObjDir_ppc}weight.o"
# Linkage rule
"{TargetName}" ŸŸ {PPC_OBJECTS} {makefile}
lnk -O -xm library -o "{TargetName}" -export "{TargetName}.x" Â
{PPC_OBJECTS}
lnk -O -xm sharedLibrary -o "{TargetName}" -export "{TargetName}.x" Â
{PPC_OBJECTS} {PPC_LIBS} -aliases {AbsoftLibraries}absoft_aliases Â
"{AbsoftLibraries}absoft_init.o" Â
"{AbsoftLibraries}ACLib.o" Â
"{PPCLibraries}StdCRuntime.o" Â
"{SharedLibraries}StdCLib" Â
"{SharedLibraries}InterfaceLib"
# Compilation rules
"{ObjDir_ppc}areapl.o" Ÿ "areapl.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}areapl.o" areapl.f
"{ObjDir_ppc}cncvwt.o" Ÿ "cncvwt.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}cncvwt.o" cncvwt.f
"{ObjDir_ppc}dokhat.o" Ÿ "dokhat.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}dokhat.o" dokhat.f
"{ObjDir_ppc}inpip.o" Ÿ "inpip.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}inpip.o" inpip.f
"{ObjDir_ppc}ipippa.o" Ÿ "ipippa.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}ipippa.o" ipippa.f
"{ObjDir_ppc}iplace.o" Ÿ "iplace.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}iplace.o" iplace.f
"{ObjDir_ppc}k12hat.o" Ÿ "k12hat.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}k12hat.o" k12hat.f
"{ObjDir_ppc}kernel3d.o" Ÿ "kernel3d.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}kernel3d.o" kernel3d.f
"{ObjDir_ppc}khvc.o" Ÿ "khvc.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}khvc.o" khvc.f
"{ObjDir_ppc}khvmat.o" Ÿ "khvmat.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}khvmat.o" khvmat.f
"{ObjDir_ppc}krnnrm.o" Ÿ "krnnrm.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}krnnrm.o" krnnrm.f
"{ObjDir_ppc}krnqne.o" Ÿ "krnqne.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}krnqne.o" krnqne.f
"{ObjDir_ppc}krnqrt.o" Ÿ "krnqrt.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}krnqrt.o" krnqrt.f
"{ObjDir_ppc}nndist.o" Ÿ "nndist.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}nndist.o" nndist.f
"{ObjDir_ppc}plarea.o" Ÿ "plarea.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}plarea.o" plarea.f
"{ObjDir_ppc}sekhat.o" Ÿ "sekhat.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}sekhat.o" sekhat.f
"{ObjDir_ppc}sort.o" Ÿ "sort.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}sort.o" sort.f
"{ObjDir_ppc}sort2.o" Ÿ "sort2.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}sort2.o" sort2.f
"{ObjDir_ppc}stkhat.o" Ÿ "stkhat.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}stkhat.o" stkhat.f
"{ObjDir_ppc}stsecal.o" Ÿ "stsecal.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}stsecal.o" stsecal.f
"{ObjDir_ppc}tribble.o" Ÿ "tribble.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}tribble.o" tribble.f
"{ObjDir_ppc}twodimmse.o" Ÿ "twodimmse.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}twodimmse.o" twodimmse.f
"{ObjDir_ppc}weight.o" Ÿ "weight.f" {makefile}
{f77_ppc} {f77_ppc_opts} -o "{ObjDir_ppc}weight.o" weight.f
clean Ÿ
Delete -i "{TargetName}" {PPC_OBJECTS}
------------------------------------------------------------------------
Andreas Papritz, Institute of Terrestrial Ecology ETH Zurich,
Grabenstr. 3, CH-8952 Schlieren, Switzerland
phone +41 1 633 6072, fax +41 1 633 1123
------------------------------------------------------------------------
Now my question is: how can I control that lnk creates a shared library
consisting of FORTRAN routines. Does anybody have a hint?
I suspect that the absoft compiler do not user "underlines" in the
function names. R for MacOS actually add a "_" symbol to fortran
functions. This is because Mac f2c uses this convention.
Can you please try to do this witht he absoft compiler ? I do not own
this compiler but it would be very important to understand what is going
on.
I ran into this same problem using the Absoft windows compiler. Absoft
Tech Support and Brian Ripley were both very helpful. After you make sure
that you are consistent with upper and lower case, and with the trailing
underscore, use .C and not .Fortran. Here was Brian's solution:
~~~~~~~
Date: Tue, 2 May 2000 07:05:15 +0100 (BST)
From: Prof Brian D Ripley <ripley@stats.ox.ac.uk>
To: Peter Macdonald <pdmmac@mcmail.cis.mcmaster.ca>
Subject: Re: dll's for R (fwd)
On Mon, 1 May 2000, Peter Macdonald wrote:
It looks as though is.loaded() recognizes the symbol but .Fortran()
doesn't. The symbol name agrees with the name found by pedump.
Use .C for `Foreign' compilers. That does no mapping. I thought I
suggested that yesterday (and I did put it in readme.packages yesterday).
*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
Peter D.M. Macdonald, D.Phil. McMaster University
Professor of Math & Statistics Hamilton, Ontario, Canada L8S 4K1
*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
On Mon, 28 May 2001, Stefano Iacus wrote:
Now my question is: how can I control that lnk creates a shared library
consisting of FORTRAN routines. Does anybody have a hint?
I suspect that the absoft compiler do not user "underlines" in the
function names. R for MacOS actually add a "_" symbol to fortran
functions. This is because Mac f2c uses this convention.
Can you please try to do this witht he absoft compiler ? I do not own
this compiler but it would be very important to understand what is going
on.
--Apple-Mail-297753183-2
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
format=flowed;
charset=us-ascii
It is an option in Absoft's f77 to prepend a _ to common names.
On Monday, May 28, 2001, at 08:24 AM, Stefano Iacus wrote:
Now my question is: how can I control that lnk creates a shared
library consisting of FORTRAN routines. Does anybody have a hint?
I suspect that the absoft compiler do not user "underlines" in the
function names. R for MacOS actually add a "_" symbol to fortran
functions. This is because Mac f2c uses this convention.
Can you please try to do this witht he absoft compiler ? I do not own
this compiler but it would be very important to understand what is
going on.
===
Jan de Leeuw; Professor and Chair, UCLA Department of Statistics;
US mail: 9432 Boulter Hall, Box 951554, Los Angeles, CA 90095-1554
phone (310)-825-9550; fax (310)-206-5658; email: deleeuw@stat.ucla.edu
homepage: http://www.stat.ucla.edu/~deleeuw
========================================================
No matter where you go, there you are. --- Buckaroo Banzai
http://www.stat.ucla.edu/sounds/nomatter.au
========================================================
--Apple-Mail-297753183-2
Content-Transfer-Encoding: quoted-printable
Content-Type: text/enriched;
charset=us-ascii
It is an option in Absoft's f77 to prepend a _ to common names.
On Monday, May 28, 2001, at 08:24 AM, Stefano Iacus wrote:
<excerpt>
<excerpt>Now my question is: how can I control that lnk creates a
shared library consisting of FORTRAN routines. Does anybody have a
hint?
</excerpt>
I suspect that the absoft compiler do not user "underlines" in the
function names. R for MacOS actually add a "_" symbol to fortran
functions. This is because Mac f2c uses this convention.
Can you please try to do this witht he absoft compiler ? I do not own
this compiler but it would be very important to understand what is
going on.
_______________________________________________
R-SIG-Mac mailing list
R-SIG-Mac@stat.math.ethz.ch
http://www.stat.math.ethz.ch/mailman/listinfo/r-sig-mac
</excerpt>
<color><param>0000,6363,1212</param>=3D=3D=3D
Jan de Leeuw; Professor and Chair, UCLA Department of Statistics;
US mail: 9432 Boulter Hall, Box 951554, Los Angeles, CA 90095-1554
phone (310)-825-9550; fax (310)-206-5658; email:
deleeuw@stat.ucla.edu
homepage:
=
</color><underline><color><param>1A1A,1A1A,FFFF</param>http://www.stat.ucl=
a.edu/~deleeuw</color></underline><color><param>0000,6363,1212</param>
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D
No matter where you go, there you are. --- Buckaroo Banzai
=20
=
</color><underline><color><param>1A1A,1A1A,FFFF</param>http://www.stat.ucl=
a.edu/sounds/nomatter.au</color></underline><color><param>0000,6363,1212</=
param>
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D
</color>=
--Apple-Mail-297753183-2--
Thanks to the hints I got, I could easily solve the problem with
Absoft's Fortran compiler f77.
The option -N15 tells the compiler to add trailing underscores to any
function and subroutine names. The Fortran routines can then be
called by R's .Fortran().
I suspect that the absoft compiler do not user "underlines" in the
function names. R for MacOS actually add a "_" symbol to fortran
functions. This is because Mac f2c uses this convention.
Can you please try to do this witht he absoft compiler ? I do not
own this compiler but it would be very important to understand what
is going on.
Andreas Papritz, Friedenstrasse 15, CH-8400 Winterthur
Tel 052 212 0763, 052 212 0953; Fax 052 212 0953
Thanks to the hints I got, I could easily solve the problem with
Absoft's Fortran compiler f77.
The option -N15 tells the compiler to add trailing underscores to
any function and subroutine names. The Fortran routines can then be
called by R's .Fortran().
I suspect that the absoft compiler do not user "underlines" in the
function names. R for MacOS actually add a "_" symbol to fortran
functions. This is because Mac f2c uses this convention.
Can you please try to do this witht he absoft compiler ? I do not
own this compiler but it would be very important to understand what
is going on.
--
Andreas Papritz, Friedenstrasse 15, CH-8400 Winterthur
Tel 052 212 0763, 052 212 0953; Fax 052 212 0953
Fine Andreas,
I'll add this info to the docs
stefano