ESRI Shapefile reader (help with dlls)

Nicholas Lewin-Koh kohnicho@comp.nus.edu.sg
Mon, 26 Jul 1999 15:45:18 +0800 (SST)


Hi,
I am working on a library of map functions for R and I have started
with code to read shapefiles (the format is not great but it is ubiquitous).
I am not a windows person, but where I am working I don't have access to
any UNIX machines easily. So here's the problem I wrote C code to read
the information out of the shapefile header and I compiled it using
the script given in Ripley and Veneables programming compliments for 
Cygwin tools. It seemed to work, however when I tried calling it from R
it didn't work (couldn't find the symbol).

here's what happend

> version
           _         
platform   Windows   
arch       x86       
os         Win32     
system     x86, Win32
status               
status.rev 0         
major      0         
minor      64.2      
year       1999      
month      July      
day        3         
language   R         
> dyn.load("D:/Nicholas/shapelib-1.2.5/Sshpopen.dll")
> read.shape("D:\Nicholas\jstuff\Geotools\examples\publands")
Error in .C("SHPOpen", as.character(shpname), as.character(shxname), as.character(access),  : C/Fortran function not in load table
> is.loaded(symbol.C("SHPOpen"))
[1] FALSE
> 

Am I doing something wrong when building the dll? here are the steps I used

gcc -mno-cygwin -O2 -c Sshpopen.c
echo LIBRARY Sshpopen > Sshpopen.def
echo EXPORTS >> Sshpopen.def
nm Sshpopen.o | \
sed -n "/^........ [BCDRT] _/s/^........ [BCDRT] _/ /p" \
>> Sshpopen.def
gcc -mno-cygwin -mdll -Wl,--base-file,Sshpopen.b \
-o Sshpopen.dll Sshpopen.o
dlltool -k -D Sshpopen.dll -b Sshpopen.b -e Sshpopen.e -d Sshpopen.def
gcc -mno-cygwin -mdll -Wl,--base-file,Sshpopen.b \
-o Sshpopen.dll Sshpopen.e Sshpopen.o
dlltool -k -D Sshpopen.dll -b Sshpopen.b -e Sshpopen.e -d Sshpopen.def
gcc -mno-cygwin -mdll -o Sshpopen.dll Sshpopen.e Sshpopen.o
rm -f Sshpopen.b Sshpopen.e

Thanks for any insight

Nicholas
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._