[Live-devel] Building live Media on Windows as a Dynamically linked library

Warren Young warren at etr-usa.com
Fri Jan 10 12:55:56 PST 2014


On 1/10/2014 13:04, Ross Finlayson wrote:
> I'm not planning on making any non-standard, Windows-specific additions
> to the code.

If you're immovable on that point, then someone needs to write a .def 
file for the DLL, which is *painful* for a large C++ library like 
live555: http://msdn.microsoft.com/en-us/library/d91k01sh.aspx

> Other operating systems have managed to use the "LIVE555
> Streaming Media" as dynamically-linked libraries in their applications -

Other linkers on other operating systems behave differently.  No big 
revelation, that.

The Visual C++ linker will automatically do the right thing if you do 
something like this:

     // In a common header file somewhere
     #if MAKING_WINDOWS_DLL
     #  define EXPORT __declspec(dllexport)
     #elif _WIN32
     #  define EXPORT __declspec(dllimport)
     #else
     #  define EXPORT
     #endif

     // In a .h file for a procedural module:
     EXPORT void myfunction(...)...

     // In a .h file for an OO module:
     class EXPORT MyClass : public MyBase ...

The dllimport clause is necessary to allow the same set of headers to be 
used while building the DLL and for building *against* the DLL.

The final clause makes EXPORT a no-op on non-Windows systems.

You'd obviously need to add -DMAKING_WINDOWS_DLL to the Windows config 
file, or to the VC++ project files.

It is a lot of work to decorate all of the public symbols this way, but 
a lot less than to create a .def file.


More information about the live-devel mailing list