s-news
[Top] [All Lists]

Re: S.dll with Fortran and C code

To: Urs Wagner <wagner@itp.phys.ethz.ch>
Subject: Re: S.dll with Fortran and C code
From: Prof Brian Ripley <ripley@stats.ox.ac.uk>
Date: Fri, 22 Oct 2004 10:29:31 +0100 (BST)
Cc: s-news@lists.biostat.wustl.edu
In-reply-to: <4178D061.9070203@itp.phys.ethz.ch>
On Fri, 22 Oct 2004, Urs Wagner wrote:

> I can build pure C or Fortran DLLs. The problem is now I should build a 
> DLL containing
> C and Fortran code. Is this possible?

Well, not usefully (what would you do with a DLL containing C code?), but
you can build a single DLL containing multiple compiled objects, some
compiled from C and some compiled from Fortran.  (Many R packages do the
latter.  So do some S-PLUS library sections I distribute.)

I do suggest this is a technical support question, so have you talked to 
your supplier of technical support?  It is very platform-specific, 
including which compilers you use, and *nothing to do with S*, the subject
of this list.


> Dan Rie wrote:
> 
> >There is no rule that says one DLL can't make use of another.  Therefore,
> >you might want to make one master dll in the language of your choice (one
> >that can be directly linked/loaded by S-Plus) and a second in the other
> >language that is only called by the first DLL.  The master DLL will have to
> >take care of ensuring that the second DLL gets loaded.  You could debug this
> >combination without solving the S-Plus interfacing problem (by compiling and
> >running your DLL as a stand-alone program, or by creating a separate test
> >program that links to the master DLL)
> >
> >If you are having trouble getting any DLL to work with S-Plus, you should
> >start by working on a fairly simple example and make sure that you can get
> >all parts of that process to work properly before moving on to more
> >difficult or obscure cases.  I found that a good first example problem is to
> >simply make sure that you can pass various kinds of arguments to a DLL, then
> >process them a little to see if you are able to correctly receive and return
> >single values and vectors over the DLL/S-Plus interface.  For instance, you
> >might try formatting a  floating number as a character variable and
> >returning that, or simply returning some constant values from your DLL.
> >Once you are able to pass character data from your DLL back to S-Plus, you
> >have a convenient way to debug the operation of your DLL when it is linked
> >to S-Plus (by making up and returning progress and variable-value messages
> >as the DLL operates on your problem).  I have also made use of MessageBoxes
> >initiated by the DLL as an early-stage debugging aide.
> >
> >
> >----- Original Message ----- 
> >From: "Urs Wagner" <wagner@itp.phys.ethz.ch>
> >To: <s-news@lists.biostat.wustl.edu>
> >Sent: Thursday, October 21, 2004 10:24 AM
> >Subject: [S] S.dll with Fortran and C code
> >
> >
> >  
> >
> >>Hello
> >>
> >>SPLUS 6.2 on WinXP
> >>
> >>I have troubles build the S.dll. The problem is I need combine Fortran
> >>and C objects
> >>into the same DLL.
> >>Has anyone an idea how to combine it?
> >>
> >>Urs
> >>--------------------------------------------------------------------
> >>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
> >>    
> >>
> >
> >  
> >
> 
> --------------------------------------------------------------------
> 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


<Prev in Thread] Current Thread [Next in Thread>