"vscode:/vscode.git/clone" did not exist on "9b51944bfbae5c971ea9a60226e081a578bbfc3b"
Unverified Commit 5d91adcf authored by Artur Wojcik's avatar Artur Wojcik Committed by GitHub
Browse files

export API symbols from MIGraphX C dynamic library (#1990)

parent c0c9001e
......@@ -26,6 +26,7 @@ add_library(migraphx_c
api.cpp
)
set_target_properties(migraphx_c PROPERTIES EXPORT_NAME c)
migraphx_generate_export_header(migraphx_c DIRECTORY migraphx/api)
# migraphx_c is stable API interface library. SO version of this should be
# bumped when binary compatibility is broken.
......
......@@ -44,7 +44,7 @@ namespace migraphx {
static thread_local bool disable_exception_catch = false; // NOLINT
extern "C" void migraphx_test_private_disable_exception_catch(bool b)
extern "C" MIGRAPHX_C_EXPORT void migraphx_test_private_disable_exception_catch(bool b)
{
disable_exception_catch = b;
}
......
This diff is collapsed.
......@@ -99,7 +99,7 @@ TEST_CASE(run_sigmoid_custom_op)
EXPECT(bool{result == migraphx::argument(s, expected_result.data())});
}
extern "C" void migraphx_test_private_disable_exception_catch(bool b);
extern "C" MIGRAPHX_C_EXPORT void migraphx_test_private_disable_exception_catch(bool);
TEST_CASE(run_sigmoid_with_incorrect_shape)
{
......
......@@ -36,6 +36,8 @@ error_type = ''
success_type = ''
try_wrap = ''
export_c_macro = 'MIGRAPHX_C_EXPORT'
c_header_preamble: List[str] = []
c_api_body_preamble: List[str] = []
cpp_header_preamble: List[str] = []
......@@ -125,7 +127,7 @@ class Type:
header_function = Template('''
${error_type} ${name}(${params});
${export_c_macro} ${error_type} ${name}(${params});
''')
function_pointer_typedef = Template('''
......@@ -177,7 +179,7 @@ class CFunction:
**kwargs)
def generate_header(self) -> str:
return self.substitute(header_function)
return self.substitute(header_function, export_c_macro=export_c_macro)
def generate_function_pointer(self, name: Optional[str] = None) -> str:
return self.substitute(function_pointer_typedef,
......
......@@ -44,7 +44,7 @@ namespace migraphx {
static thread_local bool disable_exception_catch = false; // NOLINT
extern "C" void migraphx_test_private_disable_exception_catch(bool b)
extern "C" MIGRAPHX_C_EXPORT void migraphx_test_private_disable_exception_catch(bool b)
{
disable_exception_catch = b;
}
......
......@@ -26,6 +26,9 @@
#include <stdlib.h>
#include <stdbool.h>
#include <migraphx/api/export.h>
// Add new types here
// clang-format off
#define MIGRAPHX_SHAPE_VISIT_TYPES(m) \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment