The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Inactive » comp.soft-sys.math.mathematica

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Getting an array into a C program through mathlink
Replies: 2   Last Post: Apr 3, 2013 10:50 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View  
John Fultz

Posts: 736
Registered: 12/7/04
Re: Getting an array into a C program through mathlink
Posted: Apr 3, 2013 10:50 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

If MathLink is broken, Mathematica is broken. MathLink is not just some
toss-off library used in a few corner cases by a few random users and
barely supported by Wolfram. It is a core part of the system, and if
it's busted, Mathematica won't even run. I could point to a dozen
binaries in the Mathematica distribution that work MathLink harder than
most user programs do, but I really only need to point to two -- the
Mathematica kernel and the Mathematica front end. MathLink is the one
and only mechanism by which these two components communicate with each

It is true that there can be dependencies on versions of operating
systems and libraries. And to maintain maximum compatibility with a
wide range of systems, we're very careful about which build systems and
libraries we build our binaries (MathLink, FE, kernel, etc.) against,
generally favoring somewhat older versions so we don't accidentally
slurp in newer dependencies that could break on legacy systems. The
range of operating systems and libraries Mathematica (and thus MathLink)
work against are generally pretty well advertised, and we've done a
pretty good job of supporting operating systems at least 5 years out of
date (save on MacOS, where the user culture tends to be highly
aggressive about updating operating systems, so the support window is a
bit shorter).

In summary, I would claim that, to the extent that your worries about
MathLink are true, they apply to Mathematica itself. The fact that
Mathematica is not constantly broken on every new Linux distribution
suggests that your concerns, while not invalid, are not as serious as
you seem to suggest.


John Fultz
User Interface Group
Wolfram Research, Inc.

On Apr 2, 2013, at 5:04 PM, "John D. Hendrickson and Sara Darnell" <> wrote:

> Ok I think you asked for a little more info about why mathlink which seems fine on developer's machine might not be fine elsewhere.
> Why is because to work mathlink needs to link against OS libraries which change.
> clearly says it is library hooked and versional to specific libraries.
> are some problem reports of:
> LinkConnect::"linkc": "\!\(\[LeftSkeleton] 1 \[RightSkeleton]\) is dead; attempt to connect failed."
> (there were many unsure if wr has removed them. or search Google and find some. it's hard to believe you looked hard if you can't find any.)
> For example I have Mathematix Version zzz. I later upgrade Linux. Mathlink is now broken. I may be able to run simple pre-compiled ones (unlikely to be available for my exact linux disto) but most won't work because the libs have changed or they are for a different linux distro. You'd think "just recompile mathlink apps". NO.
> To resolve this I need to run Mathematica and any mathlink apps in a chroot of a previous Linux version. Compilation of other people's mathlink apps would also have to be done in the chroot - which won't work for newer mathlink apps. Too much effort.
> You'd think I can just compile against older libs: surprise that works at compile time but not run-time since libML.a is loaded accessed through the newer libs and it is older: IT WON'T EVER WORK.
> My other choice is to buy new mathematica. But if I had any mathlink apps I needed I'd have to rewrite them since they won't compile with the new linux libs / environment. This also requires a new computer. $$ And how long is it until it's all broken again?
> (obviously upgrading Mathematica is better if you have time and money for the "upgrade escapade")
> (Note I mean Linux distribution, the linux kernel isn't usually involved. unlike the old days: often binaries today often won't work when copied from one distro to another, due to lib variations they keep uploading)
> Obviously there's another answer: wolfram releases a different mathlink that doesn't rely on lib offsets runtime :) I won't go into it but I know what breaks it.
> --------------------------------
> John Fultz wrote:

>> That's an interesting observation, but I can't say it matches my own experience. I've found MathLink to be remarkably compatible across major version number changes of Mathematica, and to be generally robust. It is the only way the FE and the kernel communicate with each other (not to mention other lesser components of the system), and the nature of that connection is not simple; I would say it uses a majority of the features that MathLink has to offer.
>> It's not clear to me exactly what you're referring to as "Wolfram problem reports". But I'd certainly be interested in knowing about any issues that you or anyone else may be experiencing with MathLink.
>> John Fultz
>> User Interface Group
>> Wolfram Research, Inc.
>> On Apr 1, 2013, at 12:00 AM, debguy <> wrote:

>>> my advice is to avoid mathlink because library issues cause
>>> compatibility problems (see Wolfram problem reports). ie after or
>>> without upgrade it's broken for someone trying to use.
>>> if you can accept fast but not fastest results I suggest this:
>>> to use "exec" in C to call math binary with piped commands (we're
>>> talking text input output) and use Put to get what into a file (can
>>> even be forked, run in background, doing it that way). then your
>>> application reads file when done (fread is fast, maybe not fast as
>>> direct read from mathlink).
>>> most tasks can be done without ever using C. doing some special
>>> graphics or something?


Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.