www.digitalmars.com         C & C++   DMDScript  

c++.announce - STLSoft 1.9.1 beta 1 released

This is a beta preview of version 1.9.1 of the STLSoft libraries, 
incorporating a considerable number of changes from the 1.8.x versions. 
Notable new additions are STL-compatible adaptors for MFC CArrays, new 
iterator classes, and dl_call(): extremely powerful Dynamic Library Function 
invocation for UNIX and Windows.

There are lots of bug fixes, changes to the directory structures, enhanced 
unit-tests, and so on. The new additions are:
- stlsoft::ostream_iterator, offering enhanced functionality over 
std::ostream_iterator
- stlsoft::transform_iterator
- COMSTL stream functions
- MFCSTL CArray class and instance adaptors
- PlatformSTL environment_map
- WinSTL console functions

and, the most interesting, the introduction of:

- the dl_call() functions for the UNIXSTL and WinSTL libraries.

dl_call() allows dynamic library functions to be invoked in a natural, 
single-statement form. It is efficient, it supports between 0 and 32 
parameters, it is exception-safe, it uses compile-time constraints to ensure 
that arguments are of POD types, it handles different calling conventions. A 
dynamic function is invoked by passing the library identifier, the function 
identifier and all the arguments that you would use to invoke the function 
if it was statically linked. For example, invoking the Win32 function 
EnumProcesses() by static linking would look like the following:

DWORD pids[100];
DWORD cbRetrieved;
BOOL bSuccess = ::EnumProcesses(&pids[0], sizeof(pids), &cbRetrieved);

EnumProcesses() has the stdcall calling convention, and resides in 
PSAPI.DLL. To invoke it dynamically, using dl_call(), would be as follows:

DWORD pids[100];
DWORD cbRetrieved;
BOOL bSuccess = winstl::dl_call("PSAPI", "stdcall:EnumProcesses", &pids[0], 
sizeof(pids), &cbRetrieved);

or:

DWORD pids[100];
DWORD cbRetrieved;
HINSTANCE hinst = ::LoadLibrary("PSAPI.DLL");
BOOL bSuccess = winstl::dl_call(hinst, "stdcall:EnumProcesses", &pids[0], 
sizeof(pids), &cbRetrieved);

It is flexible, since it allows the library identifier to be an HINSTANCE or 
any string type (e.g. char const*, std::string, etc.), and the function 
identifier to be any string type.

Download the all these goodies and more at 
http://stlsoft.org/downloads.html#stlsoft_1_9_1b1
Dec 20 2005