Boost logo

Boost :

From: James Fowler (boost_list_at_[hidden])
Date: 2005-03-03 19:33:04

Jody Hagins wrote:

>Whenever I get a spare moment, I try to get my typeid/type_info tests
>working on windows (I am convinced that if I had started programming
>under that environment, I would have chosen a different line of work).
>Right now I am struggling a bit with the DLL library that is part of
>testing type_info. Everything works fine, except when it doesn't ;->
>The documentation of LoadLibrary() says it returns NULL on failure.
>However, I can feed it some files (like a valid .LIB that is not a DLL)
>and before LoadLibrary() returns, it displays a dialog box saying "Bad
>Image." I guess this could be an exception that BCB is intercepting and
>turning into a dialog box, but the docs say nothing about an exception.
>Also, I look on google, and find that people have similar problems from
>within Java (though I could not find any solutions).
>How do I prevent that from happening?
My guess is you may have to live with it, but... The MSDN page on
specifies that it expects the name of a .dll or .exe file. It might not
be very forgiving about anything else. However, the docs also mention a
function called SetErrorMode
which can be used "to enable or disable error messages displayed by the
loader during DLL loads". Might do just what you're asking for, never
tried SetErrorMode myself (LoadLibrary however, still causes occasional
nightmares ;-) ).

Having said that, you might want to be aware that you may have quite a
bit of work beyond disabling this dialog box... the real problems start
when a call to LoadLibrary actually succeeds, but the dll you loaded
wasn't built quite the same way as the exe (or other dll) you're pulling
it into. I don't know if Boost has any magic pixie dust to catch this
(like the ABI hooks?) but LoadLibrary calls have been known to cause
quite a bit of grief when trying silly stuff like switching between
debug and release builds...

- james

>Thanks in advance!
>Unsubscribe & other changes:

 James Fowler, Open Sea Consulting, Marietta, Georgia, USA
 Do C++ Right., opening soon!

Boost list run by bdawes at, gregod at, cpdaniel at, john at