[Developers] Visual C++ and ADMB DLLs in general

Arni Magnusson arnima at hafro.is
Fri May 22 05:57:19 PDT 2009

Thanks Dave, for your explanations. I imagine this is tricky business. At 
least ADMB has DLL support for MinGW GCC 3.4.5, something ADMB-IDE will 
offer. How about the current versions of Microsoft Visual C++, can anyone 
check? This works for Microsoft Visual C++ 6.0:

   tpl2cpp -dll simpdll
   cl /c /GX /O2 -D__MSVC32__ -DOPT_LIB -I. -I%ADMB_HOME%/include 
   cl simpdll.obj admod32.lib adt32.lib ado32.lib /link 
/libpath:%ADMB_HOME%/lib /dll /export:simpdll /out:simpdll.dll

   x<-rep(0,100); f<-0
   .C("simpdll", as.integer(length(x)), as.double(x), as.double(f), "")

I have not used DLLs to hook ADMB up with other programs in my work, only 
executables. But it seems like a practical feature for analyzing a large 
number of model runs.

In a recent bootstrap analysis, I created millions of ADMB input data 
files, got millions of ADMB output files, and boiled the results down to 
thousands of summary files. Simulation studies are another example.

Since I created the bootstrap datasets in R, and then analyzed the results 
in R, a DLL would have streamlined the workflow considerably (no files 
necessary). On the other hand, I'm not sure how easy it would have been to 
reimplement the model using dll_data_types.

Extending ADMB DLL support to other compilers/platforms/admbre sounds like 
a long-term goal, whose priority will depend both on user feedback and 
feasibility. The current support is enough to demonstrate an impressive 
capability to R users on Windows, a substantial "market group" for the 
ADMB Project.


On Thu, 21 May 2009, dave fournier wrote:

> That was exactly the symptom of the problem. I hadd DLL's that worked 
> with compiler A but not with compiler B. then other ones with with B but 
> not A.  I think it has something to do with global variables and reentry 
> problems with DLL's.
> glmmADMB is an exe that gets used by R through the system() function. 
> this is better because if the ADMB program crashes R still runs. Much 
> better for development.
> --
> David A. Fournier
> P.O. Box 2040,
> Sidney, B.C. V8l 3S3
> Canada
> Phone/FAX 250-655-3364
> http://otter-rsch.com

More information about the Developers mailing list