[ADMB Users] ABMD & DLLs

Arni Magnusson arnima at hafro.is
Tue Feb 16 04:40:34 PST 2010


Hi Laurie,

When I wrote the compilation scripts for GCC (Windows and Linux) and 
Borland (Windows), I was striving for a uniform interface. Before those 
scripts, there was a wide variety of scripts with different names, and 
some worked while others didn't.

There are still a couple of remaining issues:

1. I don't have MSVC, so at the time I asked if someone could create 
similar scripts for MSVC, that would be great. I was using MSVC ten years 
ago, and I agree its debugging facilities are much better than GDB. The 
main reason I'm using GCC is so I can compile the same code in Windows and 
Linux.

I'm guessing Johnoel Ancheta created the compilation scripts for MSVC, but 
I'm not sure. In other words, if someone finds out the incantation to 
create DLLs with MSVC, please email updated compilation scripts to this 
mailing list. Johnoel will then commit them to the repository, and the 
ADMB community will thank you.

2. The ability to create DLLs in ADMB is limited. Here's my experience:

Windows GCC: yes
Windows Borland: no
Windows MSVC6: yes (old ADMB version 5.01 from 2000)
Windows MSVC8: ?
Linux GCC: no

When I was writing the compilation scripts, I inquired about this and Dave 
Fournier said that implementing the DLL support had been a pain in the 
neck in the past, and he didn't sound enthusiastic about it. You can use 
normal executables instead of DLLs in an R package, as demonstrated by the 
glmmADMB package 
(http://otter-rsch.com/admbre/examples/glmmadmb/glmmADMB.html).

I've created ADMB DLLs using Windows GCC and MSVC6 and called them from R 
to demonstrate what ADMB can do, but it requires special dll_* objects as 
you have already found out. I'm honestly not sure how much work it is to 
rewrite an existing model (say 1000 lines of TPL code) to use dll_* 
objects. Maybe it's less work than I imagine.

The DLL support for Linux GCC and Windows Borland are almost working, so a 
skilled C++ programmer could probably fix the parts that are broken. I'm 
not sure what the status of DLL support is for MSVC8.

Both of these issues (checking if MSVC can create ADMB DLLs, and adding 
DLL support for other compilers and platforms) are opportunities to 
contribute to the ADMB project.

Hope this helps,

Arni



On Tue, 16 Feb 2010, Laurie Kell wrote:

> I´m compiling DLLs using both MSVC and MinGW, this is because of the 
> better debugging facilities of MSVC and the need to use MinGW for 
> compiling ADMB code in an R package.
>
> However, there is a problem compiling and linking a DLL with MSVC. I´m 
> using "admb-9.1-windows-vc9-32bit.exe" and Microsoft Visual C++ 2008 
> i.e.
>
>  Microsoft Visual Studio 2008
>  Version 9.0.30729.1 SP
>  Microsoft .NET Framework
>  Version 3.5 SP1
>
> As adlink.bat goes into an infinite loop at lines 31 to 37 i.e.
>
>   :STARTLOOP
>   if [%2]==[] goto ENDLOOP
>   if %1==-r set re=1& shift
>   REM if %1==-s set s=& set adlib=ads32.lib& set df1b2lib=df1b2stubs.lib& 
> shift
>   if %1==-s set s=& shift
>   goto STARTLOOP
> :ENDLOOP
>
> since there is no DLL option for "-d" as there is for MinGW version 
> which includes a "-d" option i.e
>
>   if %1==-d set linker=dllwrap& shift
>
> Laurie
>


More information about the Users mailing list