[ADMB Users] ABMD & DLLs

Laurie Kell Laurie.Kell at iccat.int
Tue Feb 16 05:24:25 PST 2010


Thanks Arni for your quick response.

My interest is in running ADMB DLLs from R under Windows, Linux and Mac 
operating systems,mainly using GCC. I also have both the full and the 
free express version of MSVC and I have been able to compile ADMB DLLs 
using these so I should be able to create a script. However, I have had 
other problems in linking and in running with some versions of the ADMB 
libraries . But as I can compile the DLLs then it should be possible to 
track down runtime errors especially as we now have access to the ADMB 
source.

I have had a bit of experience in running ADMB DLLs, well at least I 
know the problems and have found some solutions. Modifying the TPL files 
is not too difficult and I can include my own C++ classes within the 
ADMB C++ code. The main problem is that most of the work is in modifying 
the C++ code not the TPL. Maybe if I can find some generic solutions 
then it will be possible at a future date to make these part of the TPL 
code.

Thanks Laurie




Arni Magnusson wrote:
> 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