[CMake] getting consistent symbol exporting across platforms

Christopher Harvey chris at basementcode.com
Sat Aug 9 14:21:22 EDT 2008


Thanks that's perfect. I searched for the visibility flag and came 
across this useful page,
for anybody reading this with the same problem:
http://gcc.gnu.org/wiki/Visibility

Andreas Pokorny wrote:
> 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
>>
>>     
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>
>   



More information about the CMake mailing list