diff --git a/cmake/onnxruntime_python.cmake b/cmake/onnxruntime_python.cmake index d00a4a0cef..fb00e827b6 100644 --- a/cmake/onnxruntime_python.cmake +++ b/cmake/onnxruntime_python.cmake @@ -49,6 +49,8 @@ if(APPLE) set(ONNXRUNTIME_SO_LINK_FLAG "-Xlinker -exported_symbols_list ${ONNXRUNTIME_ROOT}/python/exported_symbols.lst") elseif(UNIX) set(ONNXRUNTIME_SO_LINK_FLAG "-Xlinker --version-script=${ONNXRUNTIME_ROOT}/python/version_script.lds -Xlinker --no-undefined") +else() + set(ONNXRUNTIME_SO_LINK_FLAG "-DEF:${ONNXRUNTIME_ROOT}/python/pybind.def") endif() set(onnxruntime_pybind11_state_libs diff --git a/onnxruntime/python/pybind.def b/onnxruntime/python/pybind.def new file mode 100644 index 0000000000..32e0d27373 --- /dev/null +++ b/onnxruntime/python/pybind.def @@ -0,0 +1,3 @@ +LIBRARY "onnxruntime_pybind11_state.pyd" +EXPORTS + PyInit_onnxruntime_pybind11_state @1