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/WarpXWrappers.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'Source/Python/WarpXWrappers.cpp') diff --git a/Source/Python/WarpXWrappers.cpp b/Source/Python/WarpXWrappers.cpp index 6e9b6e941..ba78d2233 100644 --- a/Source/Python/WarpXWrappers.cpp +++ b/Source/Python/WarpXWrappers.cpp @@ -101,9 +101,6 @@ namespace } } -extern "C" -{ - int warpx_Real_size() { return (int)sizeof(amrex::Real); @@ -461,14 +458,14 @@ extern "C" WARPX_GET_LOVECTS_PML_SCALAR(warpx_getGfieldCPLoVects_PML, GetG_cp) WARPX_GET_LOVECTS_PML_SCALAR(warpx_getGfieldFPLoVects_PML, GetG_fp) - int* warpx_getF_pml_nodal_flag() + int* warpx_getF_pml_nodal_flag () { auto * pml = WarpX::GetInstance().GetPML(0); if (!pml) return nullptr; return getFieldNodalFlagData(pml->GetF_fp()); } - int* warpx_getG_pml_nodal_flag() + int* warpx_getG_pml_nodal_flag () { auto * pml = WarpX::GetInstance().GetPML(0); if (!pml) return nullptr; @@ -728,5 +725,3 @@ extern "C" auto & mypc = WarpX::GetInstance().GetPartContainer(); mypc.Redistribute(); } - -} -- cgit v1.2.3