Boost logo

Boost-Build :

Subject: Re: [Boost-build] Jamfile setup for load on demand DLLS
From: Vladimir Prus (ghost_at_[hidden])
Date: 2009-12-23 03:08:33


On Monday 21 December 2009 21:03:55 Robert Ramey wrote:

> Here is a small piece of code which is part of one of my serialization
> tests:
>
> HINSTANCE hDLL; // Handle to DLL
> hDLL = LoadLibrary("dll_polymorphic_derived2.dll");
> BOOST_CHECK_MESSAGE((0 != hDLL), "Failed to find/load
> dll_polymorphic_derived2" );
> save_exported(testfile);
> load_exported(testfile);
> FreeLibrary(hDLL);
>
> This runs successfully when I test from the msvc ide where the file
> "dll_polymorphic_derived2.dll"
> has been placed in the same directory as the executable. So far so good.
>
> When I update my Jamfile.v2 with
>
> lib dll_polymorphic_derived2_lib
> :
> polymorphic_derived2.cpp
> ../build//boost_serialization
> :
> <link>shared
> ;
>
> ...
>
> [ test-bsl-run test_dll_plugin : : dll_polymorphic_derived2_lib :
> <runtime-link>shared ]
>
> It's not clear to me where the dll is located. That is, should the
> following be changed?
>
> hDLL = LoadLibrary("dll_polymorphic_derived2.dll");
>
> and if so to what?.
>
> Also, I make a new version of the above code for *nix which uses dlopen,
> dlclose, etc.
> But again, I'm not sure what the path names should be.

Because the DLL is essentially an input file to the test itself, you
should specify the DLL target as the 'input-files' parameter to the
'run' function, and then use argv[1] inside the test.

Does this help?

- Volodya


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk