Comments (8)
Callback capability is not simple, and you may want to implement calling Julia from Mathematica before tackling the callback problem. But it's up to you.
Do you know if
LinkClose
is triggered automatically when the link goes out of scope?
No, it's not.
Or is there another "finalizer" mechanism we can use here?
Do check out Internal`WithLocalSettings
and this thread. J/Link's JavaBlock
is also based on WithLocalSettings
. You could make something similar to JavaBlock
, which essentially solves the same problem for J/Link. Unfortunately, it's not pretty.
from mathlink.jl.
In theory this should be fairly simple, just a case of registering a C function pointer (created from a Julia function) with MathLink, which can accept some Mathematica expression objects and return a new one.
Unfortunately I never actually figured out how to do this, if the API exists in MathLink I couldn't see it. MATLink may well have some clues – if anyone is able to dig around and figure something out then patches for this functionality are certainly welcome.
from mathlink.jl.
I have next to zero experience with Julia, so I cannot hack on this, but if you need some help with MathLink feel free to ask me (I am one of the authors of MATLink, which uses MathLink to call MATLAB from Mathematica).
from mathlink.jl.
Mathematica now has an External Languages interface:
https://reference.wolfram.com/language/guide/ExternalInterpretedLanguageInterfaces.html
which may be easier for this specific aim?
from mathlink.jl.
@simonbyrne I would not recommend it. There are no documented tools there that would help, and I am very sceptical about a one-shoe-fits-all solution. Each language should have its own, tailored interface.
from mathlink.jl.
What could potentially be an alternative to MathLink is to use the same communication method as these new interfaces, but not try to fit in the ExtenalEvaluate
framework (there's no documented way to do that anyway).
They use ZeroMQ for interprocess communication, through ZeroMQLink`
. Most of ZeroMQLink is now in documented system functions (see Socket*
).
There still needs to be a way to encode/decode data. The new WXF format could be used for this. Its structure is fully documented, so it saves some of the guesswork that's typically needed when dealing with MathLink.
I mention all this as a potential alternative to MathLink. Do not take it as a recommendation.
from mathlink.jl.
Thanks @szhorvat, that is very good to know.
from mathlink.jl.
At the moment I am thinking about a similar problem of passing a Julia function or other object into mathematica (e.g. an arbitrary Julia function to NDSolve
), which would require calling back into the Julia session.
One option is to open up a new link for each such function, which could then be polled in a background task in Julia (on the Mathematica side this would mean that calling the function would result in putting the arguments on the link, and getting the results back again).
The main problem with this approach would be knowing when to clean up the task on the Julia side. @szhorvat Do you know if LinkClose
is triggered automatically when the link goes out of scope? Or is there another "finalizer" mechanism we can use here?
from mathlink.jl.
Related Issues (20)
- Handling of BigFloats/BigInts HOT 1
- Mysterious AssertionError HOT 7
- Registering HOT 1
- Replacements are no fun HOT 1
- mathlink path rename on Windows? HOT 3
- Update including new licencse broke MathLink HOT 1
- Error after typing "using MathLink" HOT 2
- Naive question, how to install it on Mac HOT 2
- Plotting? HOT 2
- How can I set the environment variables of JULIA_MATHKERNEL and JULIA_MATHLINK in linux? HOT 6
- Multiple returns HOT 4
- Extracting values from lists HOT 8
- `==` dosen't work for WExpr generated by `@W_cmd` HOT 1
- Including overloading of basic algebra HOT 10
- Bug: Julia Mathlink installation on Windows 10 HOT 4
- TagBot trigger issue HOT 9
- Possibility of allocation-free from julia via MathLink HOT 2
- Problem : UndefVarError: set_texOutput not defined HOT 2
- ParseError: KaTeX parse error HOT 2
- MathLink package can't find file "dep.jl" & fail to precompiling pkg. HOT 5
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 mathlink.jl.