Skip to content

Commit

Permalink
Use reinterpret_cast to convert function pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
metab0t committed Nov 22, 2024
1 parent 4f65128 commit fdf0d8b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion include/pyoptinterface/dylib.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class DynamicLibrary
fmt::print("function {} is not loaded correctly\n", #f); \
_load_success = false; \
} \
_function_pointers[#f] = ptr; \
_function_pointers[#f] = reinterpret_cast<void *>(ptr); \
}

#define IS_DYLIB_LOAD_SUCCESS _load_success
Expand Down
4 changes: 2 additions & 2 deletions lib/gurobi_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ bool load_library(const std::string &path)
{
DYLIB_LOAD_FUNCTION(GRBloadenvinternal);
DYLIB_LOAD_FUNCTION(GRBemptyenvinternal);
_function_pointers["GRBloadenv"] = &GRBloadenv_1200;
_function_pointers["GRBemptyenv"] = &GRBemptyenv_1200;
_function_pointers["GRBloadenv"] = reinterpret_cast<void *>(&GRBloadenv_1200);
_function_pointers["GRBemptyenv"] = reinterpret_cast<void *>(&GRBemptyenv_1200);

// Now check there is no nullptr in _function_pointers
_load_success = true;
Expand Down

0 comments on commit fdf0d8b

Please sign in to comment.