[ADMB Users] DLLs

dave fournier davef at otter-rsch.com
Wed Apr 27 12:05:50 PDT 2011


I thought it might be interesting to revisit this.  I used the example 
bimix.tpl from the manual.
I have attached the tpl file the data and the R script. this is for linux.
It is a crummy data example I just made up.

you create the cpp and htp files with the command

    tpl2cpp -dll bimix

Now you want to compile to a shared library.  This is a lot easier than 
it used to be.
first you need to rebuild admb-10.1 adding the -fPIC option for the 
compiler.

Here is my script to compile bimix.cpp and produce a shared library
named bimix.so


ADMB_HOME=/dave2/admb-10.1/build/admb-10.1-linux-gcc4.4.5-64bit/admb-10.1-linux-gcc4.4.5-64bit

g++  --shared  -fPIC -ggdb -w -fpermissive  -DUSE_LAPLACE -Dlinux 
-D__GNUDOS__ -o$1.so $1.cpp \
   -I. -I${ADMB_HOME}/include \
   -L${ADMB_HOME}/lib \
   -ladt -lads -ladmod -ldf1b2s -ladt -lads -ladmod -ldf1b2s \
   -ladt -lads -ladmod -ldf1b2s -ladt -lads -ladmod -ldf1b2s


under R this is loaded with the command

    dyn.load("bimix.so")


To run the example in R you type

    source("bimix.r")

and it all just works for me.


This all seems to work and it works when I call the routine twice as in 
the R script.

So maybe this is not too hard

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: bimix.r
URL: <http://lists.admb-project.org/pipermail/users/attachments/20110427/136f89ad/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: bimix.tpl
URL: <http://lists.admb-project.org/pipermail/users/attachments/20110427/136f89ad/attachment-0001.ksh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bimix.dat
Type: application/x-ns-proxy-autoconfig
Size: 338 bytes
Desc: not available
URL: <http://lists.admb-project.org/pipermail/users/attachments/20110427/136f89ad/attachment.dat>


More information about the Users mailing list