From ripley at stats.ox.ac.uk  Mon Feb  5 16:28:35 2007
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Mon, 5 Feb 2007 15:28:35 +0000 (GMT)
Subject: [Rd] How to customize the list of exported functions in a
 shared library (update)
In-Reply-To: <8807621.post@talk.nabble.com>
References: <8803194.post@talk.nabble.com>
	<20070205140354.GA12059@tehun.pair.com>
	<8807456.post@talk.nabble.com> <8807621.post@talk.nabble.com>
Message-ID: <Pine.LNX.4.64.0702051520400.27282@gannet.stats.ox.ac.uk>

On Mon, 5 Feb 2007, Vladimir Eremeev wrote:

> Vladimir Eremeev wrote:

Something important is missing here!

>> It calls gcc:
>> gcc  "-I../sources" "-I."  -IC:/PROGRA~1/R/include  -gdwarf-2 -Wall -O2
>> -std=gnu99   -c rsnns.c -o rsnns.o
>> gcc  -shared   -o Rsnns.dll Rsnns.def [ lots of *.o ]  -LC:/PROGRA~1/R/bin
>> "-Lc:/mingw/lib" -lfl -liberty   -lR
>>
>> The file Rsnns.def is generated automatically and is deleted on success.
>> On error, it remains, and contains export of all symbols.
>> Probably GCC generates it, I haven't tracked its generation in the R's
>> scripts.

Actually, you *still* haven't tracked its generation in the R's scripts.

> This file is generated in R scripts.
> MkRules contains
>
> %.dll:
> 	@$(ECHO) EXPORTS > $*.def
> 	@$(NM) $^ | $(SED) -n 's/^........ [BCDRT] _/ /p' >> $*.def
> 	$(DLL) -shared $(DLLFLAGS) $($*-DLLFLAGS) -o $@ $*.def $^ $($*-DLLLIBS)
> $(DLLLIBS)
> 	@$(RM) $*.def

Yes, but that is not necessarily the rule used.  See MakeDll which 
contains the rules for generating DLLs to be linked into R, and CHANGES 
for the documentation.

-- 
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] How to customize the list of exported functions in a shared library (update)
Prof Brian Ripley