Skip to content

Commit e0ae595

Browse files
committed
fix test_xprs_interface build
1 parent 9e17f6e commit e0ae595

File tree

2 files changed

+19
-14
lines changed

2 files changed

+19
-14
lines changed

ortools/xpress/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ set_target_properties(${NAME} PROPERTIES
2121
CXX_EXTENSIONS OFF
2222
POSITION_INDEPENDENT_CODE ON
2323
)
24+
if(MSVC AND BUILD_SHARED_LIBS)
25+
target_compile_definitions(${NAME} PUBLIC "OR_BUILD_DLL")
26+
target_compile_definitions(${NAME} PRIVATE "OR_EXPORT")
27+
endif()
2428
target_include_directories(${NAME} PRIVATE
2529
${PROJECT_SOURCE_DIR}
2630
${PROJECT_BINARY_DIR})

ortools/xpress/environment.h

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <string>
2121

2222
#include "absl/status/status.h"
23+
#include "ortools/base/macros.h"
2324

2425
extern "C" {
2526
typedef struct xo_prob_struct* XPRSprob;
@@ -487,21 +488,21 @@ extern std::function<int(XPRSprob prob, int control, int value)> XPRSsetintcontr
487488
extern std::function<int(XPRSprob prob, int control, XPRSint64 value)> XPRSsetintcontrol64;
488489
extern std::function<int(XPRSprob prob, int control, double value)> XPRSsetdblcontrol;
489490
extern std::function<int(XPRSprob prob, int control, const char* value)> XPRSsetstrcontrol;
490-
extern std::function<int(XPRSprob prob, int control, int* p_value)> XPRSgetintcontrol;
491-
extern std::function<int(XPRSprob prob, int control, XPRSint64* p_value)> XPRSgetintcontrol64;
492-
extern std::function<int(XPRSprob prob, int control, double* p_value)> XPRSgetdblcontrol;
493-
extern std::function<int(XPRSprob prob, int control, char* value, int maxbytes, int* p_nbytes)> XPRSgetstringcontrol;
494-
extern std::function<int(XPRSprob prob, int attrib, int* p_value)> XPRSgetintattrib;
495-
extern std::function<int(XPRSprob prob, int attrib, double* p_value)> XPRSgetdblattrib;
491+
OR_DLL extern std::function<int(XPRSprob prob, int control, int* p_value)> XPRSgetintcontrol;
492+
OR_DLL extern std::function<int(XPRSprob prob, int control, XPRSint64* p_value)> XPRSgetintcontrol64;
493+
OR_DLL extern std::function<int(XPRSprob prob, int control, double* p_value)> XPRSgetdblcontrol;
494+
OR_DLL extern std::function<int(XPRSprob prob, int control, char* value, int maxbytes, int* p_nbytes)> XPRSgetstringcontrol;
495+
OR_DLL extern std::function<int(XPRSprob prob, int attrib, int* p_value)> XPRSgetintattrib;
496+
OR_DLL extern std::function<int(XPRSprob prob, int attrib, double* p_value)> XPRSgetdblattrib;
496497
extern std::function<int(XPRSprob prob, const char* name, int* p_id, int* p_type)> XPRSgetcontrolinfo;
497498
extern std::function<int(XPRSprob prob, const char* probname, int ncols, int nrows, const char rowtype[], const double rhs[], const double rng[], const double objcoef[], const int start[], const int collen[], const int rowind[], const double rowcoef[], const double lb[], const double ub[])> XPRSloadlp;
498499
extern std::function<int(XPRSprob prob, const char* probname, int ncols, int nrows, const char rowtype[], const double rhs[], const double rng[], const double objcoef[], const XPRSint64 start[], const int collen[], const int rowind[], const double rowcoef[], const double lb[], const double ub[])> XPRSloadlp64;
499-
extern std::function<int(XPRSprob prob, double objcoef[], int first, int last)> XPRSgetobj;
500-
extern std::function<int(XPRSprob prob, double rhs[], int first, int last)> XPRSgetrhs;
501-
extern std::function<int(XPRSprob prob, double rng[], int first, int last)> XPRSgetrhsrange;
502-
extern std::function<int(XPRSprob prob, double lb[], int first, int last)> XPRSgetlb;
503-
extern std::function<int(XPRSprob prob, double ub[], int first, int last)> XPRSgetub;
504-
extern std::function<int(XPRSprob prob, int row, int col, double* p_coef)> XPRSgetcoef;
500+
OR_DLL extern std::function<int(XPRSprob prob, double objcoef[], int first, int last)> XPRSgetobj;
501+
OR_DLL extern std::function<int(XPRSprob prob, double rhs[], int first, int last)> XPRSgetrhs;
502+
OR_DLL extern std::function<int(XPRSprob prob, double rng[], int first, int last)> XPRSgetrhsrange;
503+
OR_DLL extern std::function<int(XPRSprob prob, double lb[], int first, int last)> XPRSgetlb;
504+
OR_DLL extern std::function<int(XPRSprob prob, double ub[], int first, int last)> XPRSgetub;
505+
OR_DLL extern std::function<int(XPRSprob prob, int row, int col, double* p_coef)> XPRSgetcoef;
505506
extern std::function<int(XPRSprob prob, int* status, double duals[], int first, int last)> XPRSgetduals;
506507
extern std::function<int(XPRSprob prob, int* status, double djs[], int first, int last)> XPRSgetredcosts;
507508
extern std::function<int(XPRSprob prob, int nrows, int ncoefs, const char rowtype[], const double rhs[], const double rng[], const int start[], const int colind[], const double rowcoef[])> XPRSaddrows;
@@ -517,8 +518,8 @@ extern std::function<int(XPRSprob prob, int objsense)> XPRSchgobjsense;
517518
extern std::function<int(XPRSprob prob, char* errmsg)> XPRSgetlasterror;
518519
extern std::function<int(XPRSprob prob, int rowstat[], int colstat[])> XPRSgetbasis;
519520
extern std::function<int(XPRSprob prob, const char* filename, const char* flags)> XPRSwriteprob;
520-
extern std::function<int(XPRSprob prob, char rowtype[], int first, int last)> XPRSgetrowtype;
521-
extern std::function<int(XPRSprob prob, char coltype[], int first, int last)> XPRSgetcoltype;
521+
OR_DLL extern std::function<int(XPRSprob prob, char rowtype[], int first, int last)> XPRSgetrowtype;
522+
OR_DLL extern std::function<int(XPRSprob prob, char coltype[], int first, int last)> XPRSgetcoltype;
522523
extern std::function<int(XPRSprob prob, int nbounds, const int colind[], const char bndtype[], const double bndval[])> XPRSchgbounds;
523524
extern std::function<int(XPRSprob prob, int length, const double solval[], const int colind[], const char* name)> XPRSaddmipsol;
524525
extern std::function<int(XPRSprob prob, double x[], double slack[], double duals[], double djs[])> XPRSgetlpsol;

0 commit comments

Comments
 (0)