From 0f0823af3f1fb373708318fd1a4360ea22eef614 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Fri, 3 Dec 2021 16:37:15 -0800 Subject: extern 'C': Only in Headers (#2624) * extern 'C': Only in Headers This does not belong in source files. Seen as missing symbols on CI for macOS and Intel, both clang compiles. ``` File "/usr/local/lib/python3.9/site-packages/pywarpx/_libwarpx.py", line 94, in from ._libwarpx import * File "/usr/local/lib/python3.9/site-packages/pywarpx/_libwarpx.py", line 94, in libwarpx.warpx_Real_size.restype = ctypes.c_int File "/usr/local/Cellar/python@3.9/3.9.9/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ctypes/__init__.py", line 387, in __getattr__ libwarpx.warpx_Real_size.restype = ctypes.c_int File "/usr/local/Cellar/python@3.9/3.9.9/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ctypes/__init__.py", line 387, in __getattr__ func = self.__getitem__(name) File "/usr/local/Cellar/python@3.9/3.9.9/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ctypes/__init__.py", line 392, in __getitem__ func = self._FuncPtr((name_or_ordinal, self)) AttributeError: dlsym(0x7f89a3edb820, warpx_Real_size): symbol not found func = self.__getitem__(name) File "/usr/local/Cellar/python@3.9/3.9.9/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ctypes/__init__.py", line 392, in __getitem__ func = self._FuncPtr((name_or_ordinal, self)) AttributeError: dlsym(0x7fe5d36c5190, warpx_Real_size): symbol not found AttributeError: /home/runner/.local/lib/python3.8/site-packages/pywarpx/libwarpx.3d.so: undefined symbol: warpx_Real_size ``` Refs.: - https://stackoverflow.com/questions/2168241/is-it-required-to-add-extern-c-in-source-file-also - https://isocpp.org/wiki/faq/mixing-c-and-cpp#call-cpp * Fix: Declare amrex_init_with_inited_mpi AMReX mocks out MPI anyway in serial builds. * Wrapper: Add Missing Declarations - fields - PML fields * Wrapper: More Missing Declarations - `warpx_getCellSize` --- Source/Python/WarpX_py.cpp | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) (limited to 'Source/Python/WarpX_py.cpp') diff --git a/Source/Python/WarpX_py.cpp b/Source/Python/WarpX_py.cpp index e2705c554..1d69ea8f3 100644 --- a/Source/Python/WarpX_py.cpp +++ b/Source/Python/WarpX_py.cpp @@ -7,21 +7,16 @@ */ #include "WarpX_py.H" - -extern "C" { - - WARPX_CALLBACK_PY_FUNC_0 warpx_py_afterinit = nullptr; - WARPX_CALLBACK_PY_FUNC_0 warpx_py_beforeEsolve = nullptr; - WARPX_CALLBACK_PY_FUNC_0 warpx_py_poissonsolver = nullptr; - WARPX_CALLBACK_PY_FUNC_0 warpx_py_afterEsolve = nullptr; - WARPX_CALLBACK_PY_FUNC_0 warpx_py_beforedeposition = nullptr; - WARPX_CALLBACK_PY_FUNC_0 warpx_py_afterdeposition = nullptr; - WARPX_CALLBACK_PY_FUNC_0 warpx_py_particlescraper = nullptr; - WARPX_CALLBACK_PY_FUNC_0 warpx_py_particleloader = nullptr; - WARPX_CALLBACK_PY_FUNC_0 warpx_py_beforestep = nullptr; - WARPX_CALLBACK_PY_FUNC_0 warpx_py_afterstep = nullptr; - WARPX_CALLBACK_PY_FUNC_0 warpx_py_afterrestart = nullptr; - WARPX_CALLBACK_PY_FUNC_0 warpx_py_particleinjection = nullptr; - WARPX_CALLBACK_PY_FUNC_0 warpx_py_appliedfields = nullptr; - -} +WARPX_CALLBACK_PY_FUNC_0 warpx_py_afterinit = nullptr; +WARPX_CALLBACK_PY_FUNC_0 warpx_py_beforeEsolve = nullptr; +WARPX_CALLBACK_PY_FUNC_0 warpx_py_poissonsolver = nullptr; +WARPX_CALLBACK_PY_FUNC_0 warpx_py_afterEsolve = nullptr; +WARPX_CALLBACK_PY_FUNC_0 warpx_py_beforedeposition = nullptr; +WARPX_CALLBACK_PY_FUNC_0 warpx_py_afterdeposition = nullptr; +WARPX_CALLBACK_PY_FUNC_0 warpx_py_particlescraper = nullptr; +WARPX_CALLBACK_PY_FUNC_0 warpx_py_particleloader = nullptr; +WARPX_CALLBACK_PY_FUNC_0 warpx_py_beforestep = nullptr; +WARPX_CALLBACK_PY_FUNC_0 warpx_py_afterstep = nullptr; +WARPX_CALLBACK_PY_FUNC_0 warpx_py_afterrestart = nullptr; +WARPX_CALLBACK_PY_FUNC_0 warpx_py_particleinjection = nullptr; +WARPX_CALLBACK_PY_FUNC_0 warpx_py_appliedfields = nullptr; -- cgit v1.2.3