[CMake] getting consistent symbol exporting across platforms

Andreas Pokorny andreas.pokorny at gmail.com
Sat Aug 9 14:12:04 EDT 2008


Hi,

You should therefore test whether your GCC supports
-fvisibility=hidden, then gcc behaves
like msvc building for shared object files. Then you probably have a
macro that you place
between class and class-name. That macro probably contains either
declspec - import or
declspec - export, when building with msvc. For gcc you simply set the macro:

__attribute__ ((visibility("default")))

in both cases, building the library and including the library somewhere else.

visibility is available in a stable form since 4.0.2. Before that
there were issues with
the standard library.

kind regards
Andreas Pokorny


2008/8/9 Christopher Harvey <chris at basementcode.com>:
> Hi,
> I read that gcc exports all symbols by default where as with msvc one has to
> put something like dllExport in the symbols to be exported. I'd like to have
> the same symbols be exported on both msvc and gcc. Is there a way I could
> use cmake to make both compilers behave the same way while creating a shared
> library?
>
> thanks,
> Chris.
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>


More information about the CMake mailing list