Re: [Rd] call fortran in R

2005-08-04 Thread Ales Ziberna
If I understand correctly, you used
.Fortran("wrapper",)

The problem might be that the function name ("wrapper") was changed in the 
compilation of the code! See the mail bellow for clues (a previous post on 
R-help by Duncan Murdoch)

Natalie Hawkins wrote:
> Using R 2.0.1 on Windows XP, I am getting an error
> msg:
>
> Error in .Fortran("conic", nxy = nxy, npt = npt, CP =
> cp, EP1 = ep1, EP2 = ep2,  :
>
> Fortran function name not in load table
>
> I am wondering if there is a way to see what function
> names are in the load table?  Maybe the function name
> has been altered?

You need to look at the DLL to see what name it is exporting. I believe
R would be looking for "conic_".  If your Fortran compiler doesn't
append underscores, you'll get this error.

You might want to look at this page

http://www.stats.uwo.ca/faculty/murdoch/software/compilingDLLs/index.html#badname

or this one

http://www.stats.uwo.ca/faculty/murdoch/software/compilingDLLs/fortran.html

for more help.

Duncan Murdoch

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] call fortran in R

2005-08-04 Thread Sébastien Durand
Thanks for your help,

I had read those web pages already, and the post you referred to  
already.

So I will try to give more details to what I have done till now

First I must mention again that I am using a mac under tiger.  So I  
am using .so files.

My fortran file is called kmeans.f, and my subroutine or wrapper I  
named  it "wrapper"

There is my first line of code

 subroutine wrapper(n, p, nran, mat, ishort, w, z, ntran, istand,  
k1, k2, iassign, iseed)

In the terminal:
 R CMD SHLIB  ~/Desktop/Fortan_kmeans/kmeans3.fg77
 -fno-common  -g -O2 -c /Users/sebas/Desktop/Fortan_kmeans/ 
kmeans3.f -o /Users/sebas/Desktop/Fortan_kmeans/kmeans3.o
 gcc-3.3 -bundle -flat_namespace -undefined suppress -L/usr/ 
local/lib -o
 /Users/sebas/Desktop/Fortan_kmeans/kmeans3.so /Users/sebas/ 
Desktop/Fortan_kmeans/kmeans3.o
 -L/usr/local/lib/gcc/powerpc-apple-darwin6.8/3.4.2 -lg2c - 
lSystem -framework R

The files append to compile without any warnings.

In R:

 > dyn.load("/Users/sebas/Desktop/Fortan_kmeans/kmeans3.so")
 > getLoadedDLLs()

Filename
base 
base
grDevices /Library/Frameworks/R.framework/Resources/library/grDevices/ 
libs/grDevices.so
stats /Library/Frameworks/R.framework/Resources/library/ 
stats/libs/stats.so
methods   /Library/Frameworks/R.framework/Resources/library/ 
methods/libs/methods.so
kmeans3   /Users/sebas/Desktop/ 
Fortan_kmeans/kmeans3.so
   Dynamic.Lookup
base   FALSE
grDevices  FALSE
stats  FALSE
methodsFALSE
kmeans3 TRUE


Dyn.load seems to work since if I type in getLoadedDLLs()  I can see  
the link.

 > zozo=.Fortran(symbol.For("wrapper"),n=as.integer(n), p=as.integer 
(p), nran=as.integer(nran), mat=as.matrix(mat), ishort=as.vector 
(ishort), w=as.vector(w),ntran=as.integer(ntran), istand=as.integer 
(istand), k1=as.integer(k1), k2=as.integer(k2), iassign=as.integer 
(iassign), iseed=as.integer(iseed))
Erreur dans .Fortran(symbol.For("wrapper"), n = as.integer(n), p =  
as.integer(p),  :
 nom de fonction "Fortran" absent de la table d'allocation

Even so I am using in the name parameter of the .Fortran function,  
"wrapper", "kmeans3", "wrapper_" or "kmeans3_"

I always get the same error call telling me that the fonction  
"Fortran" is not in the allocation table

That is where I am at now, it has been 4 days I am digging into docs  
but I haven't been able to find what I am doing wrong.

R is so great, I got tons of Fortran lines and subroutine to  
implement in R but I guess I am missing a little thing to make it  
work and now I really don't have a cue how to solve that problem.

Cheers

I will be anxiously waiting for any reply

Sébastien


>
> If I understand correctly, you used
> .Fortran("wrapper",)
>
> The problem might be that the function name ("wrapper") was changed  
> in the
> compilation of the code! See the mail bellow for clues (a previous  
> post on
> R-help by Duncan Murdoch)
>
> Natalie Hawkins wrote:
> > Using R 2.0.1 on Windows XP, I am getting an error
> > msg:
> >
> > Error in .Fortran("conic", nxy = nxy, npt = npt, CP =
> > cp, EP1 = ep1, EP2 = ep2,  :
> >
> > Fortran function name not in load table
> >
> > I am wondering if there is a way to see what function
> > names are in the load table?  Maybe the function name
> > has been altered?
>
> You need to look at the DLL to see what name it is exporting. I  
> believe
> R would be looking for "conic_".  If your Fortran compiler doesn't
> append underscores, you'll get this error.
>
> You might want to look at this page
>
> http://www.stats.uwo.ca/faculty/murdoch/software/compilingDLLs/ 
> index.html#badname
>
> or this one
>
> http://www.stats.uwo.ca/faculty/murdoch/software/compilingDLLs/ 
> fortran.html
>
> for more help.
>
> Duncan Murdoch

[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] call fortran in R

2005-08-04 Thread Sébastien Durand
At the beginning I was not using symbol.For(), and whatever I add a  
"_" or not

e.g.:

.Fortran("wrapper",...

I get the same error

Sebastien



> You want to just say:
>
> .Fortran("wrapper", ...
>
> not
>
> .Fortran(symbol.For("wrapper"), ...
>
> Patrick Burns
> [EMAIL PROTECTED]
> +44 (0)20 8525 0696
> http://www.burns-stat.com
> (home of S Poetry and "A Guide for the Unwilling S User")
>
> Sébastien Durand wrote:
>
>
>> Thanks for your help,
>>
>> I had read those web pages already, and the post you referred to   
>> already.
>>
>> So I will try to give more details to what I have done till now
>>
>> First I must mention again that I am using a mac under tiger.  So  
>> I  am using .so files.
>>
>> My fortran file is called kmeans.f, and my subroutine or wrapper  
>> I  named  it "wrapper"
>>
>> There is my first line of code
>>
>> subroutine wrapper(n, p, nran, mat, ishort, w, z, ntran,  
>> istand,  k1, k2, iassign, iseed)
>>
>> In the terminal:
>> R CMD SHLIB  ~/Desktop/Fortan_kmeans/kmeans3.fg77
>> -fno-common  -g -O2 -c /Users/sebas/Desktop/Fortan_kmeans/  
>> kmeans3.f -o /Users/sebas/Desktop/Fortan_kmeans/kmeans3.o
>> gcc-3.3 -bundle -flat_namespace -undefined suppress -L/ 
>> usr/ local/lib -o
>> /Users/sebas/Desktop/Fortan_kmeans/kmeans3.so /Users/ 
>> sebas/ Desktop/Fortan_kmeans/kmeans3.o
>> -L/usr/local/lib/gcc/powerpc-apple-darwin6.8/3.4.2 -lg2c -  
>> lSystem -framework R
>>
>> The files append to compile without any warnings.
>>
>> In R:
>>
>> > dyn.load("/Users/sebas/Desktop/Fortan_kmeans/kmeans3.so")
>> > getLoadedDLLs()
>>
>> Filename
>> base  
>>base
>> grDevices /Library/Frameworks/R.framework/Resources/library/ 
>> grDevices/ libs/grDevices.so
>> stats /Library/Frameworks/R.framework/Resources/ 
>> library/ stats/libs/stats.so
>> methods   /Library/Frameworks/R.framework/Resources/library/  
>> methods/libs/methods.so
>> kmeans3   /Users/sebas/Desktop/  
>> Fortan_kmeans/kmeans3.so
>>   Dynamic.Lookup
>> base   FALSE
>> grDevices  FALSE
>> stats  FALSE
>> methodsFALSE
>> kmeans3 TRUE
>>
>>
>> Dyn.load seems to work since if I type in getLoadedDLLs()  I can  
>> see  the link.
>>
>> > zozo=.Fortran(symbol.For("wrapper"),n=as.integer(n),  
>> p=as.integer (p), nran=as.integer(nran), mat=as.matrix(mat),  
>> ishort=as.vector (ishort), w=as.vector(w),ntran=as.integer(ntran),  
>> istand=as.integer (istand), k1=as.integer(k1), k2=as.integer(k2),  
>> iassign=as.integer (iassign), iseed=as.integer(iseed))
>> Erreur dans .Fortran(symbol.For("wrapper"), n = as.integer(n), p  
>> =  as.integer(p),  :
>> nom de fonction "Fortran" absent de la table d'allocation
>>
>> Even so I am using in the name parameter of the .Fortran  
>> function,  "wrapper", "kmeans3", "wrapper_" or "kmeans3_"
>>
>> I always get the same error call telling me that the fonction   
>> "Fortran" is not in the allocation table
>>
>> That is where I am at now, it has been 4 days I am digging into  
>> docs  but I haven't been able to find what I am doing wrong.
>>
>> R is so great, I got tons of Fortran lines and subroutine to   
>> implement in R but I guess I am missing a little thing to make it   
>> work and now I really don't have a cue how to solve that problem.
>>
>> Cheers
>>
>> I will be anxiously waiting for any reply
>>
>> Sébastien
>>
>>
>>
>>
>>> If I understand correctly, you used
>>> .Fortran("wrapper",)
>>>
>>> The problem might be that the function name ("wrapper") was  
>>> changed  in the
>>> compilation of the code! See the mail bellow for clues (a  
>>> previous  post on
>>> R-help by Duncan Murdoch)
>>>
>>> Natalie Hawkins wrote:
>>>
>>>
 Using R 2.0.1 on Windows XP, I am getting an error
 msg:

 Error in .Fortran("conic", nxy = nxy, npt = npt, CP =
 cp, EP1 = ep1, EP2 = ep2,  :

 Fortran function name not in load table

 I am wondering if there is a way to see what function
 names are in the load table?  Maybe the function name
 has been altered?


>>> You need to look at the DLL to see what name it is exporting. I   
>>> believe
>>> R would be looking for "conic_".  If your Fortran compiler doesn't
>>> append underscores, you'll get this error.
>>>
>>> You might want to look at this page
>>>
>>> http://www.stats.uwo.ca/faculty/murdoch/software/compilingDLLs/  
>>> index.html#badname
>>>
>>> or this one
>>>
>>> http://www.stats.uwo.ca/faculty/murdoch/software/compilingDLLs/  
>>> fortran.html
>>>
>>> for more help.
>>>
>>> Duncan Murdoch
>>>
>>>
>>
>> [[alternative HTML version deleted]]
>>
>>
>> - 
>> ---
>>
>> __
>> R-devel@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-d

Re: [Rd] call fortran in R

2005-08-04 Thread Duncan Murdoch
Sébastien Durand wrote:
> Thanks for your help,
> 
> I had read those web pages already, and the post you referred to  
> already.
> 
> So I will try to give more details to what I have done till now
> 
> First I must mention again that I am using a mac under tiger.  So I  
> am using .so files.
> 
> My fortran file is called kmeans.f, and my subroutine or wrapper I  
> named  it "wrapper"
> 
> There is my first line of code
> 
>  subroutine wrapper(n, p, nran, mat, ishort, w, z, ntran, istand,  
> k1, k2, iassign, iseed)
> 
> In the terminal:
>  R CMD SHLIB  ~/Desktop/Fortan_kmeans/kmeans3.fg77
>  -fno-common  -g -O2 -c /Users/sebas/Desktop/Fortan_kmeans/ 
> kmeans3.f -o /Users/sebas/Desktop/Fortan_kmeans/kmeans3.o
>  gcc-3.3 -bundle -flat_namespace -undefined suppress -L/usr/ 
> local/lib -o
>  /Users/sebas/Desktop/Fortan_kmeans/kmeans3.so /Users/sebas/ 
> Desktop/Fortan_kmeans/kmeans3.o
>  -L/usr/local/lib/gcc/powerpc-apple-darwin6.8/3.4.2 -lg2c - 
> lSystem -framework R
> 
> The files append to compile without any warnings.
> 
> In R:
> 
>  > dyn.load("/Users/sebas/Desktop/Fortan_kmeans/kmeans3.so")
>  > getLoadedDLLs()
> 
> Filename
> base 
> base
> grDevices /Library/Frameworks/R.framework/Resources/library/grDevices/ 
> libs/grDevices.so
> stats /Library/Frameworks/R.framework/Resources/library/ 
> stats/libs/stats.so
> methods   /Library/Frameworks/R.framework/Resources/library/ 
> methods/libs/methods.so
> kmeans3   /Users/sebas/Desktop/ 
> Fortan_kmeans/kmeans3.so
>Dynamic.Lookup
> base   FALSE
> grDevices  FALSE
> stats  FALSE
> methodsFALSE
> kmeans3 TRUE
> 
> 
> Dyn.load seems to work since if I type in getLoadedDLLs()  I can see  
> the link.
> 
>  > zozo=.Fortran(symbol.For("wrapper"),n=as.integer(n), p=as.integer 
> (p), nran=as.integer(nran), mat=as.matrix(mat), ishort=as.vector 
> (ishort), w=as.vector(w),ntran=as.integer(ntran), istand=as.integer 
> (istand), k1=as.integer(k1), k2=as.integer(k2), iassign=as.integer 
> (iassign), iseed=as.integer(iseed))
> Erreur dans .Fortran(symbol.For("wrapper"), n = as.integer(n), p =  
> as.integer(p),  :
>  nom de fonction "Fortran" absent de la table d'allocation
> 
> Even so I am using in the name parameter of the .Fortran function,  
> "wrapper", "kmeans3", "wrapper_" or "kmeans3_"
> 
> I always get the same error call telling me that the fonction  
> "Fortran" is not in the allocation table

That message could be more useful, couldn't it?

I think your problem is using symbol.For().  .Fortran uses that (or some 
internal equivalent), so it will end up being used twice, and R is 
probably looking for wrapper__, when the real name is wrapper_.

Duncan Murdoch


> 
> That is where I am at now, it has been 4 days I am digging into docs  
> but I haven't been able to find what I am doing wrong.
> 
> R is so great, I got tons of Fortran lines and subroutine to  
> implement in R but I guess I am missing a little thing to make it  
> work and now I really don't have a cue how to solve that problem.
> 
> Cheers
> 
> I will be anxiously waiting for any reply
> 
> Sébastien
> 
> 
> 
>>If I understand correctly, you used
>>.Fortran("wrapper",)
>>
>>The problem might be that the function name ("wrapper") was changed  
>>in the
>>compilation of the code! See the mail bellow for clues (a previous  
>>post on
>>R-help by Duncan Murdoch)
>>
>>Natalie Hawkins wrote:
>>
>>>Using R 2.0.1 on Windows XP, I am getting an error
>>>msg:
>>>
>>>Error in .Fortran("conic", nxy = nxy, npt = npt, CP =
>>>cp, EP1 = ep1, EP2 = ep2,  :
>>>
>>>Fortran function name not in load table
>>>
>>>I am wondering if there is a way to see what function
>>>names are in the load table?  Maybe the function name
>>>has been altered?
>>
>>You need to look at the DLL to see what name it is exporting. I  
>>believe
>>R would be looking for "conic_".  If your Fortran compiler doesn't
>>append underscores, you'll get this error.
>>
>>You might want to look at this page
>>
>>http://www.stats.uwo.ca/faculty/murdoch/software/compilingDLLs/ 
>>index.html#badname
>>
>>or this one
>>
>>http://www.stats.uwo.ca/faculty/murdoch/software/compilingDLLs/ 
>>fortran.html
>>
>>for more help.
>>
>>Duncan Murdoch
> 
> 
>   [[alternative HTML version deleted]]
> 
> 
> 
> 
> 
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] call fortran in R

2005-08-04 Thread Duncan Murdoch
Sébastien Durand wrote:
> At the beginning I was not using symbol.For(), and whatever I add a  
> "_" or not
> 
> e.g.:
> 
> .Fortran("wrapper",...
> 
> I get the same error

You could look at symbol.For("wrapper"), and see if the name it prints 
is exported from your .so.  I don't know how to see the exports of a 
.so, I use Windows.

Alternatively (and probably better overall), you could get your DLL to 
register its exports with R.  This is explained in the "Writing R 
Extensions" manual.  It should help to prevent any odd naming 
conventions of your compiler from causing trouble, and you'll only have 
to worry about odd parameter passing conventions (and how to create the 
C language registration function).

Duncan Murdoch
> 
> Sebastien
> 
> 
> 
> 
>>You want to just say:
>>
>>.Fortran("wrapper", ...
>>
>>not
>>
>>.Fortran(symbol.For("wrapper"), ...
>>
>>Patrick Burns
>>[EMAIL PROTECTED]
>>+44 (0)20 8525 0696
>>http://www.burns-stat.com
>>(home of S Poetry and "A Guide for the Unwilling S User")
>>
>>Sébastien Durand wrote:
>>
>>
>>
>>>Thanks for your help,
>>>
>>>I had read those web pages already, and the post you referred to   
>>>already.
>>>
>>>So I will try to give more details to what I have done till now
>>>
>>>First I must mention again that I am using a mac under tiger.  So  
>>>I  am using .so files.
>>>
>>>My fortran file is called kmeans.f, and my subroutine or wrapper  
>>>I  named  it "wrapper"
>>>
>>>There is my first line of code
>>>
>>>subroutine wrapper(n, p, nran, mat, ishort, w, z, ntran,  
>>>istand,  k1, k2, iassign, iseed)
>>>
>>>In the terminal:
>>>R CMD SHLIB  ~/Desktop/Fortan_kmeans/kmeans3.fg77
>>>-fno-common  -g -O2 -c /Users/sebas/Desktop/Fortan_kmeans/  
>>>kmeans3.f -o /Users/sebas/Desktop/Fortan_kmeans/kmeans3.o
>>>gcc-3.3 -bundle -flat_namespace -undefined suppress -L/ 
>>>usr/ local/lib -o
>>>/Users/sebas/Desktop/Fortan_kmeans/kmeans3.so /Users/ 
>>>sebas/ Desktop/Fortan_kmeans/kmeans3.o
>>>-L/usr/local/lib/gcc/powerpc-apple-darwin6.8/3.4.2 -lg2c -  
>>>lSystem -framework R
>>>
>>>The files append to compile without any warnings.
>>>
>>>In R:
>>>
>>>
dyn.load("/Users/sebas/Desktop/Fortan_kmeans/kmeans3.so")
getLoadedDLLs()
>>>
>>>Filename
>>>base  
>>>   base
>>>grDevices /Library/Frameworks/R.framework/Resources/library/ 
>>>grDevices/ libs/grDevices.so
>>>stats /Library/Frameworks/R.framework/Resources/ 
>>>library/ stats/libs/stats.so
>>>methods   /Library/Frameworks/R.framework/Resources/library/  
>>>methods/libs/methods.so
>>>kmeans3   /Users/sebas/Desktop/  
>>>Fortan_kmeans/kmeans3.so
>>>  Dynamic.Lookup
>>>base   FALSE
>>>grDevices  FALSE
>>>stats  FALSE
>>>methodsFALSE
>>>kmeans3 TRUE
>>>
>>>
>>>Dyn.load seems to work since if I type in getLoadedDLLs()  I can  
>>>see  the link.
>>>
>>>
zozo=.Fortran(symbol.For("wrapper"),n=as.integer(n),  
>>>
>>>p=as.integer (p), nran=as.integer(nran), mat=as.matrix(mat),  
>>>ishort=as.vector (ishort), w=as.vector(w),ntran=as.integer(ntran),  
>>>istand=as.integer (istand), k1=as.integer(k1), k2=as.integer(k2),  
>>>iassign=as.integer (iassign), iseed=as.integer(iseed))
>>>Erreur dans .Fortran(symbol.For("wrapper"), n = as.integer(n), p  
>>>=  as.integer(p),  :
>>>nom de fonction "Fortran" absent de la table d'allocation
>>>
>>>Even so I am using in the name parameter of the .Fortran  
>>>function,  "wrapper", "kmeans3", "wrapper_" or "kmeans3_"
>>>
>>>I always get the same error call telling me that the fonction   
>>>"Fortran" is not in the allocation table
>>>
>>>That is where I am at now, it has been 4 days I am digging into  
>>>docs  but I haven't been able to find what I am doing wrong.
>>>
>>>R is so great, I got tons of Fortran lines and subroutine to   
>>>implement in R but I guess I am missing a little thing to make it   
>>>work and now I really don't have a cue how to solve that problem.
>>>
>>>Cheers
>>>
>>>I will be anxiously waiting for any reply
>>>
>>>Sébastien
>>>
>>>
>>>
>>>
>>>
If I understand correctly, you used
.Fortran("wrapper",)

The problem might be that the function name ("wrapper") was  
changed  in the
compilation of the code! See the mail bellow for clues (a  
previous  post on
R-help by Duncan Murdoch)

Natalie Hawkins wrote:



>Using R 2.0.1 on Windows XP, I am getting an error
>msg:
>
>Error in .Fortran("conic", nxy = nxy, npt = npt, CP =
>cp, EP1 = ep1, EP2 = ep2,  :
>
>Fortran function name not in load table
>
>I am wondering if there is a way to see what function
>names are in the load table?  Maybe the function name
>has been altered?
>
>

You need to look at the DLL to see what name it is exporting. I   
believe
R woul

Re: [Rd] call fortran in R

2005-08-04 Thread Prof Brian Ripley

On Thu, 4 Aug 2005, Duncan Murdoch wrote:


Sébastien Durand wrote:

At the beginning I was not using symbol.For(), and whatever I add a
"_" or not

e.g.:

.Fortran("wrapper",...

I get the same error


You could look at symbol.For("wrapper"), and see if the name it prints
is exported from your .so.  I don't know how to see the exports of a
.so, I use Windows.


On a Unix-alike, nm -g foo.so.  (This looks like MacOS X, although that 
was never stated.)



Alternatively (and probably better overall), you could get your DLL to
register its exports with R.  This is explained in the "Writing R
Extensions" manual.  It should help to prevent any odd naming
conventions of your compiler from causing trouble, and you'll only have
to worry about odd parameter passing conventions (and how to create the
C language registration function).

Duncan Murdoch


Sebastien





You want to just say:

.Fortran("wrapper", ...

not

.Fortran(symbol.For("wrapper"), ...

Patrick Burns
[EMAIL PROTECTED]
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of S Poetry and "A Guide for the Unwilling S User")

Sébastien Durand wrote:




Thanks for your help,

I had read those web pages already, and the post you referred to
already.

So I will try to give more details to what I have done till now

First I must mention again that I am using a mac under tiger.  So
I  am using .so files.

My fortran file is called kmeans.f, and my subroutine or wrapper
I  named  it "wrapper"

There is my first line of code

   subroutine wrapper(n, p, nran, mat, ishort, w, z, ntran,
istand,  k1, k2, iassign, iseed)

In the terminal:
   R CMD SHLIB  ~/Desktop/Fortan_kmeans/kmeans3.fg77
   -fno-common  -g -O2 -c /Users/sebas/Desktop/Fortan_kmeans/
kmeans3.f -o /Users/sebas/Desktop/Fortan_kmeans/kmeans3.o
   gcc-3.3 -bundle -flat_namespace -undefined suppress -L/
usr/ local/lib -o
   /Users/sebas/Desktop/Fortan_kmeans/kmeans3.so /Users/
sebas/ Desktop/Fortan_kmeans/kmeans3.o
   -L/usr/local/lib/gcc/powerpc-apple-darwin6.8/3.4.2 -lg2c -
lSystem -framework R

The files append to compile without any warnings.

In R:



dyn.load("/Users/sebas/Desktop/Fortan_kmeans/kmeans3.so")
getLoadedDLLs()


Filename
base
  base
grDevices /Library/Frameworks/R.framework/Resources/library/
grDevices/ libs/grDevices.so
stats /Library/Frameworks/R.framework/Resources/
library/ stats/libs/stats.so
methods   /Library/Frameworks/R.framework/Resources/library/
methods/libs/methods.so
kmeans3   /Users/sebas/Desktop/
Fortan_kmeans/kmeans3.so
 Dynamic.Lookup
base   FALSE
grDevices  FALSE
stats  FALSE
methodsFALSE
kmeans3 TRUE


Dyn.load seems to work since if I type in getLoadedDLLs()  I can
see  the link.



zozo=.Fortran(symbol.For("wrapper"),n=as.integer(n),


p=as.integer (p), nran=as.integer(nran), mat=as.matrix(mat),
ishort=as.vector (ishort), w=as.vector(w),ntran=as.integer(ntran),
istand=as.integer (istand), k1=as.integer(k1), k2=as.integer(k2),
iassign=as.integer (iassign), iseed=as.integer(iseed))
Erreur dans .Fortran(symbol.For("wrapper"), n = as.integer(n), p
=  as.integer(p),  :
   nom de fonction "Fortran" absent de la table d'allocation

Even so I am using in the name parameter of the .Fortran
function,  "wrapper", "kmeans3", "wrapper_" or "kmeans3_"

I always get the same error call telling me that the fonction
"Fortran" is not in the allocation table

That is where I am at now, it has been 4 days I am digging into
docs  but I haven't been able to find what I am doing wrong.

R is so great, I got tons of Fortran lines and subroutine to
implement in R but I guess I am missing a little thing to make it
work and now I really don't have a cue how to solve that problem.

Cheers

I will be anxiously waiting for any reply

Sébastien






If I understand correctly, you used
.Fortran("wrapper",)

The problem might be that the function name ("wrapper") was
changed  in the
compilation of the code! See the mail bellow for clues (a
previous  post on
R-help by Duncan Murdoch)

Natalie Hawkins wrote:




Using R 2.0.1 on Windows XP, I am getting an error
msg:

Error in .Fortran("conic", nxy = nxy, npt = npt, CP =
cp, EP1 = ep1, EP2 = ep2,  :

Fortran function name not in load table

I am wondering if there is a way to see what function
names are in the load table?  Maybe the function name
has been altered?




You need to look at the DLL to see what name it is exporting. I
believe
R would be looking for "conic_".  If your Fortran compiler doesn't
append underscores, you'll get this error.

You might want to look at this page

http://www.stats.uwo.ca/faculty/murdoch/software/compilingDLLs/
index.html#badname

or this one

http://www.stats.uwo.ca/faculty/murdoch/software/compilingDLLs/
fortran.html

for more help.

Duncan Murdoch




   [[alternative HTML version deleted]]


-

[Rd] call fortran in R

2005-08-04 Thread Sébastien Durand
Ok,

Dear all,

I have state previously, I am using mac os X tiger on a g5, using the  
last version of R 2.1.1

When I type in the terminal

nm -g ~/Desktop/Fortan_kmeans/kmeans3.so
or
nm /Users/sebas/Desktop/Fortan_kmeans/kmeans3.so | grep ' T '

Nothing appears on my screen

When I type

nm  ~/Desktop/Fortan_kmeans/kmeans3.so

this is what I get:

0fe0 t __dyld_func_lookup
 t __mh_bundle_header
1000 d dyld__mh_bundle_header
1008 s dyld_func_lookup_pointer
1004 s dyld_lazy_symbol_binding_entry_point
0fb0 t dyld_stub_binding_helper


By the way, yes I have tried
 is.loaded("wrapper") ?
And is always return FALSE

S.

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] call fortran in R

2005-08-04 Thread Sébastien Durand
Dear all,

Since the command you ask me to type doesn't show anything
Here some more information, on my system and on the foo.so compiled file

I am using g77 version 3.4.4  Configured with: ../gcc/configure -- 
enable-threads=posix --enable-languages=f77

I am using gcc version 4.0.0 20041026 (Apple Computer, Inc. build 4061)
 Configured with: /private/var/tmp/gcc/gcc-4061.obj~8/src/ 
configure --disable-checking --prefix=/usr --mandir=/share/man -- 
enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^ 
+.-]*$/s/$/-4.0/
 --with-gxx-include-dir=/include/gcc/darwin/4.0/c++ -- 
build=powerpc-apple-darwin8 --host=powerpc-apple-darwin8 -- 
target=powerpc-apple-darwin8

I don't know if this can be of any help to you but there is again how  
I compile the foo.f

Double-G5:~ sebas$ R CMD SHLIB  ~/Desktop/Fortan_kmeans/kmeans3.f
 g77   -fno-common  -g -O2 -c /Users/sebas/Desktop/ 
Fortan_kmeans/kmeans3.f -o /Users/sebas/Desktop/Fortan_kmeans/kmeans3.o
 gcc-3.3 -bundle -flat_namespace -undefined suppress -L/usr/ 
local/lib -o /Users/sebas/Desktop/Fortan_kmeans/kmeans3.so /Users/ 
sebas/Desktop/Fortan_kmeans/kmeans3.o  -L/usr/local/lib/gcc/powerpc- 
apple-darwin6.8/3.4.2 -lg2c -lSystem -framework R


There is all the info about the foo.so file using nm -a option  
instead of -g:


Double-G5:~ sebas$ nm -a ~/Desktop/Fortan_kmeans/kmeans3.so
0fe4 - 01 0114 SLINE
0fb0 - 01 SO
0fd8 - 01 010d SLINE
0fdc - 01 010e SLINE
0fe0 - 01 010f SLINE
0fec - 01 0116 SLINE
0fe8 - 01 0115 SLINE
1000 - 01 SO
1000 - 01 011b SLINE
0ffc - 01 011a SLINE
0ff8 - 01 0119 SLINE
0fb4 - 01 0104 SLINE
0fb8 - 01 0105 SLINE
0fbc - 01 0106 SLINE
0fc0 - 01 0107 SLINE
0fc4 - 01 0108 SLINE
0ff4 - 01 0118 SLINE
0fc8 - 01 0109 SLINE
0fcc - 01 010a SLINE
0fd0 - 01 010b SLINE
0fd4 - 01 010c SLINE
0ff0 - 01 0117 SLINE
0fb0 - 01    SOL /SourceCache/Csu/Csu-57//
0fb0 - 01    SOL /SourceCache/Csu/Csu-57/bundle1.s
0fb0 - 01    SOL /SourceCache/Csu/Csu-57/bundle1.s
0fb0 - 01    SOL /SourceCache/Csu/Csu-57/bundle1.s
0fb0 - 01 SO /Users/sebas/
0fb0 - 01 SO /Users/sebas/Desktop/Fortan_kmeans/kmeans3.f
0fb0 - 01    SOL 
0fb0 - 01    SOL 
0fe0 t __dyld_func_lookup
0fe0 - 01 0113   FUN __dyld_func_lookup:F3
 - 00   LSYM __g77_f2c_address:t(0,10)=*(0,11)[EMAIL PROTECTED];r 
(0,11);-128;127;
 - 00   LSYM __g77_f2c_complex:t(0,7)=R3;8;0;
 - 00   LSYM __g77_f2c_doublecomplex:t(0,6)=R3;16;0;
 - 00   LSYM __g77_f2c_doublereal:t(0,8)=r(0,0);8;0;
 - 00   LSYM __g77_f2c_flag:t(0,3)=r 
(0,3);-2147483648;2147483647;
 - 00   LSYM __g77_f2c_ftnint:t(0,1)=r 
(0,1);-2147483648;2147483647;
 - 00   LSYM __g77_f2c_ftnlen:t(0,2)=r 
(0,2);-2147483648;2147483647;
 - 00   LSYM __g77_f2c_integer:t(0,12)=r 
(0,12);-2147483648;2147483647;
 - 00   LSYM __g77_f2c_logical:t(0,4)=r 
(0,4);-2147483648;2147483647;
 - 00   LSYM __g77_f2c_longint:t(0,5)[EMAIL PROTECTED];r(0,5); 
0010;0007;
 - 00   LSYM __g77_f2c_real:t(0,9)=r(0,0);4;0;
 t __mh_bundle_header
 - 00   LSYM byte:t(0,26)[EMAIL PROTECTED];r(0,26);-128;127;
 - 00   LSYM char:t(0,46)[EMAIL PROTECTED];r(0,46);0;255;
 - 00   LSYM char:t2=r2;0;127;
 - 00   LSYM complex double:t(0,31)=R3;16;0;
 - 00   LSYM complex float:t(0,32)=R3;8;0;
 - 00   LSYM complex int:t(0,33)=s8real:(0,34)=r 
(0,34);-2147483648;2147483647;,0,32;imag:(0,34),32,32;;
 - 00   LSYM complex long double:t(0,30)=R3;16;0;
 - 00   LSYM complex:t(0,14)=R3;8;0;
 - 00   LSYM double complex:t(0,13)=R3;16;0;
 - 00   LSYM double precision:t(0,15)=r(0,0);8;0;
 - 00   LSYM double:t(0,36)=r(0,34);8;0;
1000 d dyld__mh_bundle_header
1008 s dyld_func_lookup_pointer
1004 s dyld_lazy_symbol_binding_entry_point
0fb0 t dyld_stub_binding_helper
0fb0 - 01 0103   FUN dyld_stub_binding_helper:F3
 - 00   LSYM float:t(0,37)=r(0,34);4;0;
 - 00    OPT gcc2_compiled.
 - 00   LSYM int:t(0,34)
 - 00   LSYM int:t1=r1;-2147483648;2147483647;
 - 00   LSYM integer4:t(0,22)[EMAIL PROTECTED];r(0,22); 
0010;0007;
 - 00   LSYM integer:t(0,28)=r(0,28);-2147483648;2147483647;
 - 00   LSYM logical2:t(0,19)[EMAIL PROTECTED];r(0,19);-128;127;
 - 00   LSYM logical3:t(0,18)[EMAIL PROTECTED];r(0,18);-32768;32767;
 - 00   LSYM logical4:t(0,17)[EMAIL PROTECTED];r(0,17); 
0010;0007;
 - 00   LSYM logical:t(0,20)=r(0,20);-2147483648;2147483647;
 - 00   LSYM long do

Re: [Rd] call fortran in R

2005-08-04 Thread Jeffrey Horner
Sébastien Durand wrote:
> Ok,
> 
> Dear all,
> 
> I have state previously, I am using mac os X tiger on a g5, using the  
> last version of R 2.1.1

Well, to Prof. Ripley's point, you never stated that you were running OS 
X, just a mac G5. Linux also runs on a G5.

Learn much, you will, from Master Ripley...

-- 
Jeffrey Horner   Computer Systems Analyst School of Medicine
615-322-8606 Department of Biostatistics   Vanderbilt University

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] call fortran in R

2005-08-04 Thread Prof Brian Ripley
So the problem IS that your symbol is not exported by your shared object, 
and you need advice on the tools you are using (not R).


On Thu, 4 Aug 2005, Sébastien Durand wrote:


Ok,

Dear all,

I have state previously, I am using mac os X tiger on a g5, using the
last version of R 2.1.1

When I type in the terminal

nm -g ~/Desktop/Fortan_kmeans/kmeans3.so
or
nm /Users/sebas/Desktop/Fortan_kmeans/kmeans3.so | grep ' T '

Nothing appears on my screen

When I type

nm  ~/Desktop/Fortan_kmeans/kmeans3.so

this is what I get:

0fe0 t __dyld_func_lookup
 t __mh_bundle_header
1000 d dyld__mh_bundle_header
1008 s dyld_func_lookup_pointer
1004 s dyld_lazy_symbol_binding_entry_point
0fb0 t dyld_stub_binding_helper


By the way, yes I have tried
is.loaded("wrapper") ?
And is always return FALSE

S.

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel




--
Brian D. Ripley,  [EMAIL PROTECTED]
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, UKFax:  +44 1865 272595__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] call fortran in R

2005-08-04 Thread Sébastien Durand
You are totally write I will learn and already did learn more than  
much with master Ripley replies.

Thus I do still state that I mentionned that I was using mac os x in  
a message that was scrubbed (???) see Duncan Murdoch reply for  
proof...  ;)

Any how next time I will make sure it shows in the initial message.

Meanwhile I will still look around to find an answer to my problem.

Thanks

> Sébastien Durand wrote:
>
>> Ok,
>>
>> Dear all,
>>
>> I have state previously, I am using mac os X tiger on a g5, using the
>> last version of R 2.1.1
>>
>
> Well, to Prof. Ripley's point, you never stated that you were  
> running OS
> X, just a mac G5. Linux also runs on a G5.
>
> Learn much, you will, from Master Ripley...
>
> -- 
> Jeffrey Horner   Computer Systems Analyst School of  
> Medicine
> 615-322-8606 Department of Biostatistics   Vanderbilt  
> University
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] add1.lm and add1.glm not handling weights and offsets properly (PR#8049)

2005-08-04 Thread d . firth
I am using R 2.1.1 under Mac OS 10.3.9.

Two related problems (see notes 1. and 2. below) are illustrated by 
results of the following:

y <- rnorm(10)
x <- z <- 1:10
is.na(x[9]) <- TRUE

lm0 <- lm(y ~ 1)
lm1 <- lm(y ~ 1, weights = rep(1, 10))

add1(lm0, scope = ~ x)  ## works ok
add1(lm1, scope = ~ x)  ## error

lm2 <- lm(y ~ 1, offset = 1:10)

add1(lm0, scope = ~ z)  ## works ok
add1(lm2, scope = ~ z)  ## gives incorrect results (ignores the offset)

glm0 <- glm(y ~ 1)
glm1 <- glm(y ~ 1, weights = rep(1, 10))
glm2 <- glm(y ~ 1, offset = rep(0, 10))

add1(glm0, scope = ~ x)  ## error
add1(glm1, scope = ~ x)  ## error
add1(glm2, scope = ~ x)  ## error



As I see it, the two problems are:

1.  add1.lm ignores any offset present in its "object" argument.

2.  add1.lm and add1.glm both take weights directly from their "object" 
argument, and add1.glm also does the same for any offset that is 
present.  But this does not work when the upper scope includes missing 
values and na.omit is used: the weights (and offset) then have the 
wrong length.  They should presumably be extracted instead from the 
reduced model frame.


If I can be of help in fixing these things, please let me know.  But I 
don't want to make things worse, or to duplicate anyone else's work.  I 
don't see this fixed in the bug-fix list at
   https://svn.r-project.org/R/trunk/NEWS
but I haven't checked whether the same problems are in the current 
r-devel.

David

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] call fortran in R

2005-08-04 Thread Sébastien Durand
Ok,  I am presently updating my system.

How do you set
  setenv gcc /usr/local/bin/gfortran.

Using bash.

Then I will the command to compile the foo.f file been the same!

I guess so

S.
>
> also gcc 4061 is a bit old -- the tiger update in 10.4.2 was
> 50xx, i think, cvs is up to apple build 5217 and is now
> gcc-4.0.1.
>
> -- jan
>
> On Aug 4, 2005, at 8:25 , Sébastien Durand wrote:
>
>
>> Dear all,
>>
>> Since the command you ask me to type doesn't show anything
>> Here some more information, on my system and on the foo.so  
>> compiled file
>>
>> I am using g77 version 3.4.4  Configured with: ../gcc/configure --
>> enable-threads=posix --enable-languages=f77
>>
>> I am using gcc version 4.0.0 20041026 (Apple Computer, Inc. build  
>> 4061)
>>  Configured with: /private/var/tmp/gcc/gcc-4061.obj~8/src/
>> configure --disable-checking --prefix=/usr --mandir=/share/man --
>> enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^
>> +.-]*$/s/$/-4.0/
>>  --with-gxx-include-dir=/include/gcc/darwin/4.0/c++ --
>> build=powerpc-apple-darwin8 --host=powerpc-apple-darwin8 --
>> target=powerpc-apple-darwin8
>>
>> I don't know if this can be of any help to you but there is again how
>> I compile the foo.f
>>
>> Double-G5:~ sebas$ R CMD SHLIB  ~/Desktop/Fortan_kmeans/kmeans3.f
>>  g77   -fno-common  -g -O2 -c /Users/sebas/Desktop/
>> Fortan_kmeans/kmeans3.f -o /Users/sebas/Desktop/Fortan_kmeans/ 
>> kmeans3.o
>>  gcc-3.3 -bundle -flat_namespace -undefined suppress -L/usr/
>> local/lib -o /Users/sebas/Desktop/Fortan_kmeans/kmeans3.so /Users/
>> sebas/Desktop/Fortan_kmeans/kmeans3.o  -L/usr/local/lib/gcc/powerpc-
>> apple-darwin6.8/3.4.2 -lg2c -lSystem -framework R
>>
>>
>> There is all the info about the foo.so file using nm -a option
>> instead of -g:
>>
>>
>> Double-G5:~ sebas$ nm -a ~/Desktop/Fortan_kmeans/kmeans3.so
>> 0fe4 - 01 0114 SLINE
>> 0fb0 - 01 SO
>> 0fd8 - 01 010d SLINE
>> 0fdc - 01 010e SLINE
>> 0fe0 - 01 010f SLINE
>> 0fec - 01 0116 SLINE
>> 0fe8 - 01 0115 SLINE
>> 1000 - 01 SO
>> 1000 - 01 011b SLINE
>> 0ffc - 01 011a SLINE
>> 0ff8 - 01 0119 SLINE
>> 0fb4 - 01 0104 SLINE
>> 0fb8 - 01 0105 SLINE
>> 0fbc - 01 0106 SLINE
>> 0fc0 - 01 0107 SLINE
>> 0fc4 - 01 0108 SLINE
>> 0ff4 - 01 0118 SLINE
>> 0fc8 - 01 0109 SLINE
>> 0fcc - 01 010a SLINE
>> 0fd0 - 01 010b SLINE
>> 0fd4 - 01 010c SLINE
>> 0ff0 - 01 0117 SLINE
>> 0fb0 - 01    SOL /SourceCache/Csu/Csu-57//
>> 0fb0 - 01    SOL /SourceCache/Csu/Csu-57/bundle1.s
>> 0fb0 - 01    SOL /SourceCache/Csu/Csu-57/bundle1.s
>> 0fb0 - 01    SOL /SourceCache/Csu/Csu-57/bundle1.s
>> 0fb0 - 01 SO /Users/sebas/
>> 0fb0 - 01 SO /Users/sebas/Desktop/Fortan_kmeans/kmeans3.f
>> 0fb0 - 01    SOL 
>> 0fb0 - 01    SOL 
>> 0fe0 t __dyld_func_lookup
>> 0fe0 - 01 0113   FUN __dyld_func_lookup:F3
>>  - 00   LSYM __g77_f2c_address:t(0,10)=*(0,11)[EMAIL PROTECTED];r
>> (0,11);-128;127;
>>  - 00   LSYM __g77_f2c_complex:t(0,7)=R3;8;0;
>>  - 00   LSYM __g77_f2c_doublecomplex:t(0,6)=R3;16;0;
>>  - 00   LSYM __g77_f2c_doublereal:t(0,8)=r(0,0);8;0;
>>  - 00   LSYM __g77_f2c_flag:t(0,3)=r
>> (0,3);-2147483648;2147483647;
>>  - 00   LSYM __g77_f2c_ftnint:t(0,1)=r
>> (0,1);-2147483648;2147483647;
>>  - 00   LSYM __g77_f2c_ftnlen:t(0,2)=r
>> (0,2);-2147483648;2147483647;
>>  - 00   LSYM __g77_f2c_integer:t(0,12)=r
>> (0,12);-2147483648;2147483647;
>>  - 00   LSYM __g77_f2c_logical:t(0,4)=r
>> (0,4);-2147483648;2147483647;
>>  - 00   LSYM __g77_f2c_longint:t(0,5)[EMAIL PROTECTED];r(0,5);
>> 0010;0007;
>>  - 00   LSYM __g77_f2c_real:t(0,9)=r(0,0);4;0;
>>  t __mh_bundle_header
>>  - 00   LSYM byte:t(0,26)[EMAIL PROTECTED];r(0,26);-128;127;
>>  - 00   LSYM char:t(0,46)[EMAIL PROTECTED];r(0,46);0;255;
>>  - 00   LSYM char:t2=r2;0;127;
>>  - 00   LSYM complex double:t(0,31)=R3;16;0;
>>  - 00   LSYM complex float:t(0,32)=R3;8;0;
>>  - 00   LSYM complex int:t(0,33)=s8real:(0,34)=r
>> (0,34);-2147483648;2147483647;,0,32;imag:(0,34),32,32;;
>>  - 00   LSYM complex long double:t(0,30)=R3;16;0;
>>  - 00   LSYM complex:t(0,14)=R3;8;0;
>>  - 00   LSYM double complex:t(0,13)=R3;16;0;
>>  - 00   LSYM double precision:t(0,15)=r(0,0);8;0;
>>  - 00   LSYM double:t(0,36)=r(0,34);8;0;
>> 1000 d dyld__mh_bundle_header
>> 1008 s dyld_func_lookup_pointer
>> 1004 s dyld_lazy_symbol_binding_entry_point
>> 0fb0 t dyld_stub_binding_helper
>> 0fb0 - 01 0103   FUN dyld_stub_binding_helper:F3
>>  - 00   LSYM float:t(0,37)=r(0,34);4;0;
>>  - 00 

Re: [Rd] call fortran in R

2005-08-04 Thread Sébastien Durand
Forget that last reply!

I found how to set the environment!

Le 05-08-04 à 13:38, Sébastien Durand a écrit :

> Ok,  I am presently updating my system.
>
> How do you set
>   setenv gcc /usr/local/bin/gfortran.
>
> Using bash.
>
> Then I will the command to compile the foo.f file been the same!
>
> I guess so
>
> S.
>
>>
>> also gcc 4061 is a bit old -- the tiger update in 10.4.2 was
>> 50xx, i think, cvs is up to apple build 5217 and is now
>> gcc-4.0.1.
>>
>> -- jan
>>
>> On Aug 4, 2005, at 8:25 , Sébastien Durand wrote:
>>
>>
>>
>>> Dear all,
>>>
>>> Since the command you ask me to type doesn't show anything
>>> Here some more information, on my system and on the foo.so
>>> compiled file
>>>
>>> I am using g77 version 3.4.4  Configured with: ../gcc/configure --
>>> enable-threads=posix --enable-languages=f77
>>>
>>> I am using gcc version 4.0.0 20041026 (Apple Computer, Inc. build
>>> 4061)
>>>  Configured with: /private/var/tmp/gcc/gcc-4061.obj~8/src/
>>> configure --disable-checking --prefix=/usr --mandir=/share/man --
>>> enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^ 
>>> [cg][^
>>> +.-]*$/s/$/-4.0/
>>>  --with-gxx-include-dir=/include/gcc/darwin/4.0/c++ --
>>> build=powerpc-apple-darwin8 --host=powerpc-apple-darwin8 --
>>> target=powerpc-apple-darwin8
>>>
>>> I don't know if this can be of any help to you but there is again  
>>> how
>>> I compile the foo.f
>>>
>>> Double-G5:~ sebas$ R CMD SHLIB  ~/Desktop/Fortan_kmeans/kmeans3.f
>>>  g77   -fno-common  -g -O2 -c /Users/sebas/Desktop/
>>> Fortan_kmeans/kmeans3.f -o /Users/sebas/Desktop/Fortan_kmeans/
>>> kmeans3.o
>>>  gcc-3.3 -bundle -flat_namespace -undefined suppress -L/usr/
>>> local/lib -o /Users/sebas/Desktop/Fortan_kmeans/kmeans3.so /Users/
>>> sebas/Desktop/Fortan_kmeans/kmeans3.o  -L/usr/local/lib/gcc/powerpc-
>>> apple-darwin6.8/3.4.2 -lg2c -lSystem -framework R
>>>
>>>
>>> There is all the info about the foo.so file using nm -a option
>>> instead of -g:
>>>
>>>
>>> Double-G5:~ sebas$ nm -a ~/Desktop/Fortan_kmeans/kmeans3.so
>>> 0fe4 - 01 0114 SLINE
>>> 0fb0 - 01 SO
>>> 0fd8 - 01 010d SLINE
>>> 0fdc - 01 010e SLINE
>>> 0fe0 - 01 010f SLINE
>>> 0fec - 01 0116 SLINE
>>> 0fe8 - 01 0115 SLINE
>>> 1000 - 01 SO
>>> 1000 - 01 011b SLINE
>>> 0ffc - 01 011a SLINE
>>> 0ff8 - 01 0119 SLINE
>>> 0fb4 - 01 0104 SLINE
>>> 0fb8 - 01 0105 SLINE
>>> 0fbc - 01 0106 SLINE
>>> 0fc0 - 01 0107 SLINE
>>> 0fc4 - 01 0108 SLINE
>>> 0ff4 - 01 0118 SLINE
>>> 0fc8 - 01 0109 SLINE
>>> 0fcc - 01 010a SLINE
>>> 0fd0 - 01 010b SLINE
>>> 0fd4 - 01 010c SLINE
>>> 0ff0 - 01 0117 SLINE
>>> 0fb0 - 01    SOL /SourceCache/Csu/Csu-57//
>>> 0fb0 - 01    SOL /SourceCache/Csu/Csu-57/bundle1.s
>>> 0fb0 - 01    SOL /SourceCache/Csu/Csu-57/bundle1.s
>>> 0fb0 - 01    SOL /SourceCache/Csu/Csu-57/bundle1.s
>>> 0fb0 - 01 SO /Users/sebas/
>>> 0fb0 - 01 SO /Users/sebas/Desktop/Fortan_kmeans/ 
>>> kmeans3.f
>>> 0fb0 - 01    SOL 
>>> 0fb0 - 01    SOL 
>>> 0fe0 t __dyld_func_lookup
>>> 0fe0 - 01 0113   FUN __dyld_func_lookup:F3
>>>  - 00   LSYM __g77_f2c_address:t(0,10)=*(0,11)[EMAIL 
>>> PROTECTED];r
>>> (0,11);-128;127;
>>>  - 00   LSYM __g77_f2c_complex:t(0,7)=R3;8;0;
>>>  - 00   LSYM __g77_f2c_doublecomplex:t(0,6)=R3;16;0;
>>>  - 00   LSYM __g77_f2c_doublereal:t(0,8)=r(0,0);8;0;
>>>  - 00   LSYM __g77_f2c_flag:t(0,3)=r
>>> (0,3);-2147483648;2147483647;
>>>  - 00   LSYM __g77_f2c_ftnint:t(0,1)=r
>>> (0,1);-2147483648;2147483647;
>>>  - 00   LSYM __g77_f2c_ftnlen:t(0,2)=r
>>> (0,2);-2147483648;2147483647;
>>>  - 00   LSYM __g77_f2c_integer:t(0,12)=r
>>> (0,12);-2147483648;2147483647;
>>>  - 00   LSYM __g77_f2c_logical:t(0,4)=r
>>> (0,4);-2147483648;2147483647;
>>>  - 00   LSYM __g77_f2c_longint:t(0,5)[EMAIL PROTECTED];r(0,5);
>>> 0010;0007;
>>>  - 00   LSYM __g77_f2c_real:t(0,9)=r(0,0);4;0;
>>>  t __mh_bundle_header
>>>  - 00   LSYM byte:t(0,26)[EMAIL PROTECTED];r(0,26);-128;127;
>>>  - 00   LSYM char:t(0,46)[EMAIL PROTECTED];r(0,46);0;255;
>>>  - 00   LSYM char:t2=r2;0;127;
>>>  - 00   LSYM complex double:t(0,31)=R3;16;0;
>>>  - 00   LSYM complex float:t(0,32)=R3;8;0;
>>>  - 00   LSYM complex int:t(0,33)=s8real:(0,34)=r
>>> (0,34);-2147483648;2147483647;,0,32;imag:(0,34),32,32;;
>>>  - 00   LSYM complex long double:t(0,30)=R3;16;0;
>>>  - 00   LSYM complex:t(0,14)=R3;8;0;
>>>  - 00   LSYM double complex:t(0,13)=R3;16;0;
>>>  - 00   LSYM double precision:t(0,15)=r(0,0);8;0;
>>>  - 00   LSYM double:t(0,36)=r(0,34);8;0;
>>> 1000 d dyld__mh_bundle_head

Re: [Rd] call fortran in R

2005-08-04 Thread Simon Urbanek
On Aug 4, 2005, at 1:38 PM, Sébastien Durand wrote:

> Ok,  I am presently updating my system.
>
> How do you set
>   setenv gcc /usr/local/bin/gfortran.

That won't help even if you do it in bash - this is wrong!  
(F77=gfortran is what may help if you want to re-compile R with gcc4).

If you are using CRAN binary, you cannot use gfortran! gcc3 and 4 are  
not compatible.

With stock CRAN binary and the supplied g77 (Tiger on a G5) a simple  
(silly) example:

gammu:urbanek$ cat fts.f
   subroutine ffoo(a)
   double precision a(1)

   a(1) = 1.0d0
   return
   end

gammu:urbanek$ R CMD SHLIB fts.f
g77   -fno-common  -g -O2 -c fts.f -o fts.o
gcc-3.3 -bundle -flat_namespace -undefined suppress -L/usr/local/lib - 
o fts.so fts.o  -L/usr/local/lib/gcc/powerpc-apple-darwin6.8/3.4.2 - 
lg2c -lSystem -lcc_dynamic -framework R

gammu:urbanek$ nm fts.so |grep T
0fec T _ffoo_

R> dyn.load("fts.so")
R> .Fortran("ffoo",as.double(10))
[[1]]
[1] 1

R> is.loaded(symbol.For("ffoo"))
[1] TRUE
R> symbol.For("ffoo")
[1] "ffoo_"

So ... there must be something fundamentally wrong with your setup,  
otherwise I see no reason why you should have any problems. Maybe you  
should  send us the code pus exact transcript of your attempt...

Cheers,
Simon

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] valgrind complains about regex.c (PR#8043)

2005-08-04 Thread Charles Geyer
On Wed, Aug 03, 2005 at 10:25:02PM +0200, Peter Dalgaard wrote:
> [EMAIL PROTECTED] writes:
> 
> > On Tue, Aug 02, 2005 at 07:50:54AM -0400, Duncan Murdoch wrote:
> 
> > > Charlie, have you tried a recent version of R-patched?
> > 
> > Now I have.  The computer is my laptop and not connected to the net
> > so I can't upload details, but R-1.2.1-patched as of yesterday does
>  ###
> 
> This email has been a LONG time underway? ;-)

No.  I have "numerical dyslexia".  I just typed it rather than cut and
paste (I was just using someone else's account to send mail when I couldn't
connect my laptop).  Makes it hell teaching intro stats.  I have to have
all numerical examples worked in advance.  I tell people I went into math
so I could work with letters instead of numbers.

-- 
Charles Geyer
Professor, School of Statistics
University of Minnesota
[EMAIL PROTECTED]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Documentation bug in libPaths.Rd (PR#8050)

2005-08-04 Thread Weigand . Stephen
The Details section of the help for .Library / .libPaths 
has:

  "the library search path is set to the
  existing files in 'unique(new, .Library)' 
  and this is returned."

I think 'unique(new, .Library)' should be be changed 
to 'unique(c(new, .Library))'.

Thank you,

Stephen

platform sparc-sun-solaris2.9
arch sparc   
os   solaris2.9  
system   sparc, solaris2.9   
status   
major2   
minor1.0 
year 2005
month04  
day  18  
language R

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] call fortran in R

2005-08-04 Thread stefano iacus
please don't mix gcc 4.0 and g77. Also don't mix R binary which is  
gcc-3.3/g77-3.4.2 with gcc4 or gfortran.
stefano

On 04/ago/05, at 17:25, Sébastien Durand wrote:

> Dear all,
>
> Since the command you ask me to type doesn't show anything
> Here some more information, on my system and on the foo.so compiled  
> file
>
> I am using g77 version 3.4.4  Configured with: ../gcc/configure --
> enable-threads=posix --enable-languages=f77
>
> I am using gcc version 4.0.0 20041026 (Apple Computer, Inc. build  
> 4061)
>  Configured with: /private/var/tmp/gcc/gcc-4061.obj~8/src/
> configure --disable-checking --prefix=/usr --mandir=/share/man --
> enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^
> +.-]*$/s/$/-4.0/
>  --with-gxx-include-dir=/include/gcc/darwin/4.0/c++ --
> build=powerpc-apple-darwin8 --host=powerpc-apple-darwin8 --
> target=powerpc-apple-darwin8
>
> I don't know if this can be of any help to you but there is again how
> I compile the foo.f
>
> Double-G5:~ sebas$ R CMD SHLIB  ~/Desktop/Fortan_kmeans/kmeans3.f
>  g77   -fno-common  -g -O2 -c /Users/sebas/Desktop/
> Fortan_kmeans/kmeans3.f -o /Users/sebas/Desktop/Fortan_kmeans/ 
> kmeans3.o
>  gcc-3.3 -bundle -flat_namespace -undefined suppress -L/usr/
> local/lib -o /Users/sebas/Desktop/Fortan_kmeans/kmeans3.so /Users/
> sebas/Desktop/Fortan_kmeans/kmeans3.o  -L/usr/local/lib/gcc/powerpc-
> apple-darwin6.8/3.4.2 -lg2c -lSystem -framework R
>
>
> There is all the info about the foo.so file using nm -a option
> instead of -g:
>
>
> Double-G5:~ sebas$ nm -a ~/Desktop/Fortan_kmeans/kmeans3.so
> 0fe4 - 01 0114 SLINE
> 0fb0 - 01 SO
> 0fd8 - 01 010d SLINE
> 0fdc - 01 010e SLINE
> 0fe0 - 01 010f SLINE
> 0fec - 01 0116 SLINE
> 0fe8 - 01 0115 SLINE
> 1000 - 01 SO
> 1000 - 01 011b SLINE
> 0ffc - 01 011a SLINE
> 0ff8 - 01 0119 SLINE
> 0fb4 - 01 0104 SLINE
> 0fb8 - 01 0105 SLINE
> 0fbc - 01 0106 SLINE
> 0fc0 - 01 0107 SLINE
> 0fc4 - 01 0108 SLINE
> 0ff4 - 01 0118 SLINE
> 0fc8 - 01 0109 SLINE
> 0fcc - 01 010a SLINE
> 0fd0 - 01 010b SLINE
> 0fd4 - 01 010c SLINE
> 0ff0 - 01 0117 SLINE
> 0fb0 - 01    SOL /SourceCache/Csu/Csu-57//
> 0fb0 - 01    SOL /SourceCache/Csu/Csu-57/bundle1.s
> 0fb0 - 01    SOL /SourceCache/Csu/Csu-57/bundle1.s
> 0fb0 - 01    SOL /SourceCache/Csu/Csu-57/bundle1.s
> 0fb0 - 01 SO /Users/sebas/
> 0fb0 - 01 SO /Users/sebas/Desktop/Fortan_kmeans/kmeans3.f
> 0fb0 - 01    SOL 
> 0fb0 - 01    SOL 
> 0fe0 t __dyld_func_lookup
> 0fe0 - 01 0113   FUN __dyld_func_lookup:F3
>  - 00   LSYM __g77_f2c_address:t(0,10)=*(0,11)[EMAIL PROTECTED];r
> (0,11);-128;127;
>  - 00   LSYM __g77_f2c_complex:t(0,7)=R3;8;0;
>  - 00   LSYM __g77_f2c_doublecomplex:t(0,6)=R3;16;0;
>  - 00   LSYM __g77_f2c_doublereal:t(0,8)=r(0,0);8;0;
>  - 00   LSYM __g77_f2c_flag:t(0,3)=r
> (0,3);-2147483648;2147483647;
>  - 00   LSYM __g77_f2c_ftnint:t(0,1)=r
> (0,1);-2147483648;2147483647;
>  - 00   LSYM __g77_f2c_ftnlen:t(0,2)=r
> (0,2);-2147483648;2147483647;
>  - 00   LSYM __g77_f2c_integer:t(0,12)=r
> (0,12);-2147483648;2147483647;
>  - 00   LSYM __g77_f2c_logical:t(0,4)=r
> (0,4);-2147483648;2147483647;
>  - 00   LSYM __g77_f2c_longint:t(0,5)[EMAIL PROTECTED];r(0,5);
> 0010;0007;
>  - 00   LSYM __g77_f2c_real:t(0,9)=r(0,0);4;0;
>  t __mh_bundle_header
>  - 00   LSYM byte:t(0,26)[EMAIL PROTECTED];r(0,26);-128;127;
>  - 00   LSYM char:t(0,46)[EMAIL PROTECTED];r(0,46);0;255;
>  - 00   LSYM char:t2=r2;0;127;
>  - 00   LSYM complex double:t(0,31)=R3;16;0;
>  - 00   LSYM complex float:t(0,32)=R3;8;0;
>  - 00   LSYM complex int:t(0,33)=s8real:(0,34)=r
> (0,34);-2147483648;2147483647;,0,32;imag:(0,34),32,32;;
>  - 00   LSYM complex long double:t(0,30)=R3;16;0;
>  - 00   LSYM complex:t(0,14)=R3;8;0;
>  - 00   LSYM double complex:t(0,13)=R3;16;0;
>  - 00   LSYM double precision:t(0,15)=r(0,0);8;0;
>  - 00   LSYM double:t(0,36)=r(0,34);8;0;
> 1000 d dyld__mh_bundle_header
> 1008 s dyld_func_lookup_pointer
> 1004 s dyld_lazy_symbol_binding_entry_point
> 0fb0 t dyld_stub_binding_helper
> 0fb0 - 01 0103   FUN dyld_stub_binding_helper:F3
>  - 00   LSYM float:t(0,37)=r(0,34);4;0;
>  - 00    OPT gcc2_compiled.
>  - 00   LSYM int:t(0,34)
>  - 00   LSYM int:t1=r1;-2147483648;2147483647;
>  - 00   LSYM integer4:t(0,22)[EMAIL PROTECTED];r(0,22);
> 0010;0007;
>  - 00   LSYM integer:t(0,28)=r 
> (0,28);-2147483648;2147483647;
>  -