Boost logo

Boost :

From: E. Gladyshev (egladysh_at_[hidden])
Date: 2002-03-26 13:52:28


> The problem, IMO, is that most projects mis-use DLLs
> (or shared libraries in general). If you're happy
> using the DLL as
> a way to reduce link time on your project, then
> express your module interfaces as C++. If, on the
> other hand, you
> expect to use DLLs as a way to modularize the
> deployment of a configurable product, or to reuse
> code in several
> products, then a C++ interface is likely to be a
> liability....

My 2 cents, all are excelent points.

>
> Of course, there is NO way to determine how memory
> was allocated. IMO, a properly designed module
> interface will NEVER
> delegate resource management responsibility to it's
> clients. If a DLL function allocates memory (or any
> other resource)
> , the DLL must also expose a function to reclaim
> that memory (or resource) - any other combination is
> simply a time-bomb
> waiting to go off.

I totally agree. Unfortunately
clients allocate and manage the memory
quite often and many C interfaces
are designed around this requirements.

A simple example is waveInOpen() in Win32 MM SDK.
This function accepts a pointer to WAVEFORMATEX
structure. The sturcture has to be allocated
and managed by the client.

__________________________________________________
Do You Yahoo!?
Yahoo! Movies - coverage of the 74th Academy Awards®
http://movies.yahoo.com/


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk