Skip to content

Commit fdf0d8b

Browse files
committed
Use reinterpret_cast to convert function pointer
1 parent 4f65128 commit fdf0d8b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

include/pyoptinterface/dylib.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class DynamicLibrary
8383
fmt::print("function {} is not loaded correctly\n", #f); \
8484
_load_success = false; \
8585
} \
86-
_function_pointers[#f] = ptr; \
86+
_function_pointers[#f] = reinterpret_cast<void *>(ptr); \
8787
}
8888

8989
#define IS_DYLIB_LOAD_SUCCESS _load_success

lib/gurobi_model.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ bool load_library(const std::string &path)
5555
{
5656
DYLIB_LOAD_FUNCTION(GRBloadenvinternal);
5757
DYLIB_LOAD_FUNCTION(GRBemptyenvinternal);
58-
_function_pointers["GRBloadenv"] = &GRBloadenv_1200;
59-
_function_pointers["GRBemptyenv"] = &GRBemptyenv_1200;
58+
_function_pointers["GRBloadenv"] = reinterpret_cast<void *>(&GRBloadenv_1200);
59+
_function_pointers["GRBemptyenv"] = reinterpret_cast<void *>(&GRBemptyenv_1200);
6060

6161
// Now check there is no nullptr in _function_pointers
6262
_load_success = true;

0 commit comments

Comments
 (0)