Mantid
Loading...
Searching...
No Matches
kernel.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8/*
9 * Provides a function to initialize the numpy c api
10 * function pointer table in the kernel module. This
11 * is *only* required for the C++ unit tests on Windows.
12 *
13 * Normally, importing mantid.kernel into Python causes
14 * the internal numpy array api to be initialized using
15 * the _import_array call in the module startup code. This
16 * assumes that the extension module itself is only loaded
17 * by the Python dynamic loader and not the operating system
18 * library loader as a dependency on another executable. In
19 * our Python C++ unit tests the _kernel.pyd library is
20 * linked to the unittest executable and is therefore loaded
21 * by the OS. On Windows each DLL has a private symbol table
22 * and importing mantid.kernel as part of the unit test
23 * only intializes the numpy c api for that copy of the
24 * shared library. The unittest executable also sees a secondary
25 * copy from the dynamic linking. The C API pointer for this
26 * copy of the library also needs initializing and this function
27 * provides this capability.
28 */
29#ifdef _WIN32
30
31#include "MantidKernel/System.h"
32
33DLLExport void kernel_dll_import_numpy_capi_for_unittest();
34#endif
#define DLLExport
Definitions of the DLLImport compiler directives for MSVC.
Definition: System.h:53