Comments (9)
Thanks for your review and comments.
Could you elaborate more about what is an empty wrapper?
Some of the header files in SCIP only contain struct definitions, or even typedefs. I found that the actual type definitions were all moved to commons.jl
and that Clang.jl created Julia files corresponding to the C headers that only contained comments and empty lines. So, it's just a cosmetic problem.
I think Clang.jl's old generator had an option for this, but Julia's function should be loosely typed. Why do you want to catch the error at the wrapper function instead of ccall?
To be honest, I don't remember the reason for that bullet point. Maybe it was about adding a form of documentation.
If the wrapper-generation is fully automatic (it looks that way in your PR #186) then I would be very happy to merge the changes, even without taking any of the "improvements" into account.
from scip.jl.
Actually, the new Clang.jl seems to be tagged now (at 0.8).
Other potential improvements:
- Automatically generate the
wrapper.jl
file (with all theinclude()
statements). - Copy documentation strings from SCIP's headers to our Julia functions.
- Use
Ref{Ptr{}}
instead ofPtr{Ptr{}}
? - Use a stricter function signature for our
ccall
wrappers.
from scip.jl.
consider using https://github.com/analytech-solutions/CBindingGen.jl
from scip.jl.
This is also based on Clang.jl
, so it would be mostly for convenience of configuration?
from scip.jl.
yeah, my friend (the writer of the package) tried it on your package and (using the PR JuliaLang/julia#32658, I think) and auto wrapped everything but 3 inline functions. So it would add functionality by wrapping the varadic stuff you have as well.
from scip.jl.
OK, good to know.
Well, the variadic functions that are used do actually work now, there is just a risk of segfault or other unexpected behavior when targeting a new platform (or C compiler?).
I would have a look in the future, in case a re-generation of the wrapper becomes necessary after a release of a new SCIP version or similar. Right now, it works well enough for me not to bother, but PRs are welcome!
from scip.jl.
Another topic that has come up on Discourse. The auto-generated ccall
wrappers all use Ptr{X}
for some SCIP struct X
. This is fine in most cases, as we will actually pass C pointers (for SCIP-owned objects) to these calls.
However, there are also cases where we have Julia-owned Julia objects, that we want to pass to SCIP because they are used as data associated with constraints etc. The correct way of specifying the ccall
signature would be to use the Any
type. Then, the Julia object would be automatically cconvert
ed into a pointer and GC-safe (for the duration of the ccall
).
I'm not sure how to handle that in the wrapper generator, since there might not be a simple pattern to distinguish these two cases. In fact, some SCIP functions might be useful to call both ways (passing C data, or passing Julia data).
from scip.jl.
This may be fixed by #186, but I need more info.
rename
Ptr{SCIP}
toPtr{SCIP_}
, to avoid name conflict with module.
#186 generates a new module LibSCIP
, so one can use LibSCIP.SCIP
for distinguishing.
delete empty wrappers for type_*.h; the type definitions all went to commons.jl
Could you elaborate more about what is an empty wrapper?
add some missing (type/enum) definitions to manual_commons.jl (why did Clang.jl not add them?)
Clang.jl's new generator now works in a strict mode, if some symbols are missing, it just errors out and complains about which symbol is not found. Then, one needs to either add the missing header(if it's a dependent header but not living in the source tree) or use the new @add_def sym
(if it's a symbol defined in std headers or system headers). As long as the generation runs successfully, there shouldn't be missing definitions except in the case of macro definitions.
Copy documentation strings from SCIP's headers to our Julia functions.
This can be easily supported in the new generator by adding a documenter pass.
Use Ref{Ptr{}} instead of Ptr{Ptr{}}?
As discussed in JuliaInterop/Clang.jl#120, there is really no much difference between these two versions, but I can add a new option to let users make the decision.
Use a stricter function signature for our ccall wrappers.
I think Clang.jl's old generator had an option for this, but Julia's function should be loosely typed. Why do you want to catch the error at the wrapper function instead of ccall
? If you're concerned about mistakenly passing opaque pointers, which may crash Julia, you could generate mutable struct opaque_type end
instead of const opaque_type = Cvoid
by setting opaque_as_mutable_struct = true
in the generator config toml file.
from scip.jl.
closed by #186
from scip.jl.
Related Issues (20)
- SCIP still recommends installing binaries on MacOS HOT 2
- conshdlr.jl examples and ERROR: invalid SCIP stage <2>, SCIP_INVALIDCALL::SCIP_Retcode = -8 errors and their explanation? HOT 7
- SCIP fails when a problem is read from a file HOT 3
- SCIP craches due to symbol lookup error HOT 5
- Can I develop models in Julia and solve them in Python? HOT 6
- SCIP 8.0 support?! HOT 1
- SCIP EXCEPTION_ACCESS_VIOLATION In JuMP 1.1.0 and SCIP V0.11.3 on Windows 11 HOT 26
- How to trigger SCIPsolveConcurrent? HOT 3
- Multiple threads HOT 10
- SCIP not working on Windows HOT 4
- Crash When Optimizing HOT 15
- Get original variables from constraint
- Collect all feasible solutions HOT 4
- Cannot install globally in Windows HOT 1
- [EXCEPTION_ACCESS_VIOLATION] Julia 1.8.5 incompatibility with SCIP v0.11.12 HOT 1
- MultipleObjectiveAlgorithms usage HOT 1
- Implement LazyConstraint from ConstraintHandler HOT 4
- SCIP solver -- issue in "quadratic_constraints.jl". HOT 2
- Not solving the optimization model with the SCIP solver HOT 12
- `MathOptInterface.ScalarNonlinearFunction` not supported by the solver HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scip.jl.