- edited description
Handling of namespace in extension modules is not robust
This
code="""
#include <boost/lexical_cast.hpp>
"""
from dolfin import *
compile_extension_module(code)
fails with /usr/local/pkg/boost/1.53.0/gnu-ompi/include/boost/mpl/void_fwd.hpp:24:1: error: '::mpl_' has not been declared
while
code="""
#include <boost/lexical_cast.hpp>
namespace dolfin {
}
"""
from dolfin import *
compile_extension_module(code)
passes.
Comments (6)
-
reporter -
Not sure this really is a bug. Automating compilation of extension modules has to be error prone. People can pass what ever they like as code argument and an error can be triggered.
I guess the automatic wrapping of a dolfin namespace is the one that triggers this particular error. This is documented in the docstring.
Also instead of writing the include statement directly into the code you could also use
additional_system_headers=["boost/lexical_cast.hpp"]
-
reporter Also instead of writing the include statement directly into the code you could also use additional_system_headers=["boost/lexical_cast.hpp"]
Sure, but this is included by DOLFIN when you include, for example,
dolfin/la/PETScOptions.h
. Should DOLFIN headers also be included this way? -
The code gets parsed and if the public interface includes a DOLFIN type the corresponding header will automatically be included.
However, if a DOLFIN type is not included in the public interface, for example inside a function, it needs to be passed to either additional_system_headers or included in the code directly but outside the namespace.
-
reporter Ok. I'm probably expecting too much from
compile_extension_module
. Feel free to mark as WONTFIX. -
reporter - changed status to wontfix
- Log in to comment