Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C API: Highs_writeOptions is mangled #734

Closed
odow opened this issue Feb 14, 2022 · 4 comments · Fixed by #735
Closed

C API: Highs_writeOptions is mangled #734

odow opened this issue Feb 14, 2022 · 4 comments · Fixed by #735

Comments

@odow
Copy link
Collaborator

odow commented Feb 14, 2022

Highs_writeOptions and Highs_writeOptionsDeviations are mangled in the dylib that we compile in Julia:

(base) oscar@Oscars-MBP HiGHS % nm /Users/oscar/.julia/artifacts/c516a3fd40d439f7e749259a237df70a8705fae5/lib/libhighs.dylib | grep Highs_writeOptions
00000000002626e0 T __Z18Highs_writeOptionsPvPKc
00000000002627c0 T __Z28Highs_writeOptionsDeviationsPvPKc

None of the other names are:

(base) oscar@Oscars-MBP HiGHS % nm /Users/oscar/.julia/artifacts/c516a3fd40d439f7e749259a237df70a8705fae5/lib/libhighs.dylib | grep Highs_get   
0000000000263510 T _Highs_getBasicVariables
00000000002631d0 T _Highs_getBasis
0000000000263530 T _Highs_getBasisInverseCol
0000000000263520 T _Highs_getBasisInverseRow
0000000000263540 T _Highs_getBasisSolve
0000000000263550 T _Highs_getBasisTransposeSolve
0000000000262190 T _Highs_getBoolOptionValue
0000000000263fd0 T _Highs_getColsByMask
0000000000263f10 T _Highs_getColsByRange

Any immediate ideas why?

We get this unhelpful error at the moment:

julia> using HiGHS

julia> model = HiGHS.Optimizer()
A HiGHS model with 0 columns and 0 rows.

julia> Highs_writeOptions(model, "options.txt")
ERROR: could not load symbol "Highs_writeOptions":
dlsym(0x7fb8a1564de0, Highs_writeOptions): symbol not found
Stacktrace:
 [1] Highs_writeOptions(highs::HiGHS.Optimizer, filename::String)
   @ HiGHS ~/.julia/dev/HiGHS/src/gen/libhighs.jl:119
 [2] top-level scope
   @ REPL[3]:1
@jajhall
Copy link
Member

jajhall commented Feb 14, 2022

Sorry, no idea what this relates to

@odow
Copy link
Collaborator Author

odow commented Feb 14, 2022

Okay, I'll take a look when I get some time, unless someone beats me to it. Since it's just the two functions, I'm fairly confident this is a HiGHS problem as opposed to a Julia problem or our binary distribution mechanism.

@jajhall
Copy link
Member

jajhall commented Feb 14, 2022

But how can a compiler add text to the end of a method name? Highs_writeOptionsPvPKc and Highs_writeOptionsDeviationsPvPKc simply don't appear anywhere in HiGHS. Neither does the string PvPKc

@odow
Copy link
Collaborator Author

odow commented Feb 14, 2022

The mangling happens in C++ so that there is a unique symbol in the library for each instance of an overloaded methods.

But usually extern "C" disables that so that the name of the function is the same as the symbol in the library. What's weird is that this has worked for all the symbols in the C API, except for Highs_writeOptions and Highs_writeOptionsDeviations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants