You have ignored the advice to link against an import library for
Sqpe.dll. Please don't thank me yet ignore what I say!
The on-line complements at http://www.stats.ox.ac.uk/pub/MASS3/Sprog/
have been updated recently to cover (with examples) using MinGW with
S-PLUS 6.2.
On Tue, 18 May 2004, Yingfu Xie wrote:
> Hello, all,
>
> I want to build a DLL to be called by .Call in S-plus using MinGW gcc
> compiler. The 'makeseq' code in Programmer's Guide p682 is used as a test.
> However, unexpected errors occurred. (The command line, error message and
> the C code are attached below.) Does anyone have similar experience?
>
> In fact, I have succeeded building DLLs to be called by .C (thanks to Prof.
> Ripley), i.e. C code without tricks such as s-object, S_EVALUATOR etc. But
> now it doesn't work. Any helps are highly appreciated!
> I am using gcc 3.2.3 (mingw special), S-plus6.2 and Windows 2000.
>
> Regards,
> Yingfu
>
> The command line and error message:
>
> D:\s-project\temp> c:\MinGW\bin\gcc -shared -Wall -I"c:\program
> files\insightful\splus62\include" -o S.dll -O2 test-call.c
>
> C:\DOCUME~1\yxiadmin\LOCALS~1\Temp/ccQ5aaaa.o(.text+0x32):test-call.c:
> undefined reference to `_imp__S_evaluator'
> C:\DOCUME~1\yxiadmin\LOCALS~1\Temp/ccQ5aaaa.o(.text+0x4c):test-call.c:
> undefined reference to `_imp__coevec'
> C:\DOCUME~1\yxiadmin\LOCALS~1\Temp/ccQ5aaaa.o(.text+0x7b):test-call.c:
> undefined reference to `_imp__S_evaluator'
> C:\DOCUME~1\yxiadmin\LOCALS~1\Temp/ccQ5aaaa.o(.text+0x89):test-call.c:
> undefined reference to `_imp__alcvec'
> C:\DOCUME~1\yxiadmin\LOCALS~1\Temp/ccQ5aaaa.o(.text+0x93):test-call.c:
> undefined reference to `_imp__S_evaluator'
> C:\DOCUME~1\yxiadmin\LOCALS~1\Temp/ccQ5aaaa.o(.text+0x9e):test-call.c:
> undefined reference to `_imp__set_length2'
> C:\DOCUME~1\yxiadmin\LOCALS~1\Temp/ccQ5aaaa.o(.text+0xc6):test-call.c:
> undefined reference to `_imp__S_evaluator'
> C:\DOCUME~1\yxiadmin\LOCALS~1\Temp/ccQ5aaaa.o(.text+0xdb):test-call.c:
> undefined reference to `_imp__S_newio_fprintf'
> C:\DOCUME~1\yxiadmin\LOCALS~1\Temp/ccQ5aaaa.o(.text+0xe0):test-call.c:
> undefined reference to `_imp__S_evaluator'
> C:\DOCUME~1\yxiadmin\LOCALS~1\Temp/ccQ5aaaa.o(.text+0xea):test-call.c:
> undefined reference to `_imp__set_error_buf'
> C:\DOCUME~1\yxiadmin\LOCALS~1\Temp/ccQ5aaaa.o(.text+0xef):test-call.c:
> undefined reference to `_imp__S_evaluator'
> C:\DOCUME~1\yxiadmin\LOCALS~1\Temp/ccQ5aaaa.o(.text+0x106):test-call.c:
> undefined reference to `_imp__Recover'
>
> And the C code:
>
> #include <S.h>
>
> s_object *makeseq(s_object *sobjX)
> {
> S_EVALUATOR
> long i,n,xmax,*seq,*x;
> s_object *sobjSeq;
>
> /*Convert the s_object into C type data*/
> sobjX= AS_INTEGER(sobjX);
> x= INTEGER_POINTER(sobjX);
> n=GET_LENGTH(sobjX);
>
> /*Compute max value*/
> xmax=x[0];
> if (n>1) {
> for (i=1;i<n;i++){
> if (xmax < x[i]) xmax =x[i];
> }
> }
> if (xmax<0)
> PROBLEM "The maximum value (%ld) is negative.",xmax ERROR;
>
> /*Create a new s_object, set its length and get a
> C integer pointer to it */
> sobjSeq= NEW_INTEGER(0);
> SET_LENGTH(sobjSeq, xmax);
> seq=INTEGER_POINTER(sobjSeq);
>
> for (i=0;i<xmax; i++){
> seq[i]=i+1;
> }
> return(sobjSeq);
> }
> ###########################################
>
> This message has been scanned by F-Secure
> Anti-Virus for Microsoft Exchange.
>
> ###########################################
>
>
> --------------------------------------------------------------------
> This message was distributed by s-news@lists.biostat.wustl.edu. To
> unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
> the BODY of the message: unsubscribe s-news
>
>
--
Brian D. Ripley, ripley@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
|