Declaring functions/classes export from shared libraries...

Ian Lance Taylor ian@wasabisystems.com
Fri Oct 3 13:57:00 GMT 2003


Michael Burbidge <mburbidg@adobe.com> writes:

> VC++ supports the following the attribute __declspec(dllexport) to
> specify that a function or class should be exported from a shared
> library as in the following examples:
> 
> __declspec(dllexport) bool HaveLockedItems();
> 
> or for a class:
> 
> class __declspec(dllexport) Rect
> {
> ...
> };
> 
> How does one control exports using gcc?

See dllexport and dllimport here:
    http://gcc.gnu.org/onlinedocs/gcc-3.3.1/gcc/Function-Attributes.html#Function%20Attributes

Note in particular:

    On cygwin, mingw and arm-pe targets, __declspec(dllexport) is
    recognized as a synonym for __attribute__ ((dllexport)) for
    compatibility with other Windows compilers.

Ian



More information about the Gcc-help mailing list