[ADMB Users] ADMB crashes VB

JohnS sibert at hawaii.edu
Tue Jan 27 15:04:45 PST 2009


Bob Lessard originally posted this message. Can any one help?

John,

I have had a problem with ADMB for some time. When I compile and ADMB
project into a DLL and make the call from VB, the VB application
completely collapses if I can't get a hessian. If I send the dll the
option "-nohess" it will not collapse. I believe the problem is with
the error handling in the __stdcall() at the bottom of the cpp file. I
have been told by a fairly experienced c programmer that it may have
something to do with the stack (or was it heap), and the way that VB
deals with clearing it. It seems to me that the cpp created by vcc2cpp
is writing some error handling designed for a remote call from s-plus,
not VB or the likes.

see code snippet below.

thanks,
Bob

__declspec(dllexport) void _export SpringRun(double *_pars, .... ,char
** dll_options)
{
  int argc=1;
  try {
    char **argv=parse_dll_options("SpringRun",argc,*dll_options);
    do_dll_housekeeping(argc,argv);
    dll_args ad_dll(_pars, ....);
    gradient_structure::set_NO_DERIVATIVES();
    gradient_structure::set_YES_SAVE_VARIABLES_VALUES();
  #if defined(__GNUDOS__) || defined(DOS386) || defined(__DPMI32__)
|| \
     defined(__MSVC32__)
      if (!arrmblsize) arrmblsize=150000;
  #else
      if (!arrmblsize) arrmblsize=25000;
  #endif
    model_parameters mp(arrmblsize,argc,argv,ad_dll);
    mp.iprint=10;
    mp.preliminary_calculations();
    mp.computations(argc,argv);
    ad_make_code_reentrant();
  }
  catch (spdll_exception spe){ //*** my guess is the problem is here,
but I have no idea what to do about
it***********************************
    if (ad_printf && spe.e) (*ad_printf) ("abnormal exit from newtest
\n");
  }
}
}



More information about the Users mailing list