[Ipopt] IPOpt windows binaries runtime libs: /MT /MTd /MD /MDd

Vallon, Justin Justin.Vallon at deshaw.com
Fri Sep 24 10:16:05 EDT 2010


I see that Ipopt/MSVisualStudio/v8/libIpopt/libIpopt.vcproj uses /MT for release and /MTd for debug, and you have updated the Wiki.

Thanks.

-- 
-Justin


-----Original Message-----
From: Teeter, Chuck [mailto:cteeter at Suncor.com] 
Sent: Thursday, September 23, 2010 3:41 PM
To: Vallon, Justin; 'ipopt at list.coin-or.org'
Subject: RE: [Ipopt] IPOpt windows binaries runtime libs: /MT /MTd /MD /MDd

Justin,

The Ipopt static libs I originally built were done prior to the availability of the Ipopt DLLs that are now available.  I believe the distribution binaries are built using the Visual Studio project files/solutions (located in the v8-ifort folder) found in the Ipopt distribution.  I now use these same files to build Ipopt as a DLL using Visual Studio 2010.  So, if you are willing to take this on yourself (and have a Fortran compiler), there should be no reason why you couldn't use any runtime libraries you desire. 



-----Original Message-----
From: ipopt-bounces at list.coin-or.org [mailto:ipopt-bounces at list.coin-or.org] On Behalf Of Vallon, Justin
Sent: Thursday, September 23, 2010 10:32 AM
To: 'ipopt at list.coin-or.org'
Subject: Re: [Ipopt] IPOpt windows binaries runtime libs: /MT /MTd /MD /MDd

Chuck, Damien,

My understanding of mixing static and dynamic runtime libraries is that it can cause problems.  Unfortunately, many statements just end there.  KB Q140584 is more specific about problems when crossing CRT libs: Two separate heaps, cannot pass FILE*, locales setting is not shared.

If Ipopt is being shipped/blessed as a static CRT, then all heap operations should already be at arms-length: Don't use new IpoptApplication(), but instead use IpoptApplicationFactory(), etc.

That is, if the caller is a static CRT, and the DLL (Ipopt) is also a static CRT, then the API needs to be careful to insure that the DLL heap (etc) are well-isolated from the caller.  Therefore, it should not matter whether the caller is dynamic or static since the DLL keeps itself isolated.  Any problem with dynamic/static setups would also be a static/static problem.

Chuck:  Could you/we use /MTd in future builds?  I am new to the list.  Are the binaries built using the SVN vcproj files?  I can look into making the change there.

-Justin

On Wed Sep 22 17:47:45 EDT 2010, Teeter, Chuck wrote:

Sorry for the confusion on the VS2008 General Notes.  I should have use '/MTd' rather than '/MD' for the static debug version of Ipopt.  My main point was to avoid the mixing of release and debug runtimes as Damien mentions below.

________________________________
From: ipopt-bounces at list.coin-or.org [mailto:ipopt-bounces at list.coin-or.org] On Behalf Of Damien
Sent: Wednesday, September 22, 2010 3:20 PM
To: ipopt at list.coin-or.org
Subject: Re: [Ipopt] IPOpt windows binaries runtime libs: /MT /MTd /MD /MDd

Justin,

/MD means link for the C/C++ release, runtime dlls (msvc... dlls etc).  /MDd means link for the C/C++ debug, runtime dll (msvc...d dlls).  /MT means link the C/C++ release, runtime static library (libc.... libs etc).  /MTd means link the C/C++ debug, runtime static library (libc...d libs).

If the notes say release is /MT and debug is /MD, that's linking static release libraries on a release build, and dynamic release dlls on a debug build.  That's a bit unusual, and won't always work well on a debug build, depending on how exceptions or errors are handled.

It's generally not a good idea to mix debug and release runtimes, and sometimes you can get weird link errors mixing static lib and dll runtimes, so use only /MT or only /MD everywhere for release, and only /MTd or only /MDd everywhere for debug.  You can't control what third parties do with their code though.  I generally do /MD or /MDd for the runtimes, because the dll is only loaded once, no matter how many times it's linked to from anyone's library.

Damien

On 21/09/2010 9:56 AM, Vallon, Justin wrote:
The wiki https://projects.coin-or.org/Ipopt/wiki/CompilationHints ... Windows VS2008 ... General Notes says that release binaries are built with /MT and debug are built with /MD.

For debug C++ code, shouldn't I be using /MDd or /MTd in my application?  Can I mix my /MTd or /MDd code with Ipopt /MD?

I looked at the win32/debug/Ipopt.dll, and I don't see a dependency on any VS DLLs.  Maybe debug is /MTd?

--
-Justin



--
-Justin



_______________________________________________
Ipopt mailing list
Ipopt at list.coin-or.org
http://list.coin-or.org/mailman/listinfo/ipopt
------------------------------------------------------------------------
This email and its contents are private and confidential, for the sole use of the addressees. If you are not an intended recipient, copying, forwarding or other distribution of this email or its contents by any means is prohibited. If you believe that you received this email in error please notify the original sender immediately. 

Petro-Canada is a Suncor Energy business.

------------------------

Ce courriel et son contenu sont priv?s et confidentiels, et sont destin?s ? l?usage exclusif des destinataires. Si vous n'?tes pas le destinataire pr?vu, toute reproduction, transfert ou autre forme de diffusion de ce courriel ou de son contenu par quelque moyen que ce soit est interdit. Si vous croyez avoir re?u ce courriel par erreur, veuillez en aviser l'exp?diteur original imm?diatement. 

Petro-Canada est une entreprise de Suncor ?nergie.




More information about the Ipopt mailing list