DerThorsten/nifty

OSX python problems

Closed this issue · 2 comments

nifty is split up into many modules.
These different modules share code, but are different *.so files.

For instance the graph module export the class Graph.
This class is used in the rag module.

On osx, we get TypeErrors when calling functions which take things as argument which are defined/exported in a different modules.

Is this fundamental / non-fixable error?

This might be related to
pybind/pybind11#157
and
pybind/pybind11#4

Edit:
Removing the cmake-list command with
-fvisibility=hidden
fixes the issue....
Also binaries do not look terrible big
But is this a good idea??

There are some comments on thiis flag in
https://github.com/pybind/pybind11/blob/master/docs/faq.rst
This suggests that we can remove fvisibility=hidden without terrible consequences .

Should be fixed with
56c32e0

@DerThorsten alternatively you can keep the hidden visibility by default and mark in a special way the classes/functions/variables that need to be visible from other DLLs. The exact syntax varies with compilers and platforms, but it is relatively easy to create small macros for this. See for instance:

https://gcc.gnu.org/wiki/Visibility

Getting it working on GCC/clang is the easiest actually, just need to prepend __attribute__ ((visibility ("default"))) to the declaration of entities that you want to export from that .so. Windows is a bit more complicated, but doable as well.