There's an example of LinkObject
-based passing in the LibraryLink documentation. Unfortunately the cell in the documentation notebook is corrupted, but to skip that problem I'm going to reproduce it in plain text here:
funLink = LibraryFunctionLoad["demo_LinkObject", "reverseString", LinkObject, LinkObject];
funLink["forward"]
On OS X I get the output LibraryFunctionError["LIBRARY_FUNCTION_ERROR", 6]
instead of the expected drawrof
. On Windows it works. Looking at the source code of the example, I cannot immediately see what's wrong with it. A precompiled version of this example library comes with Mathematica, and it's what the above commands should load (verified with FindLibrary
). So I tried recompiling it, but the error is still there.
You'll find the complete source code in:
SystemOpen@FileNameJoin[{$InstallationDirectory, "SystemFiles", "Links", "LibraryLink", "LibraryResources", "Source"}]
Question: Is this a bug in LibraryLink/MathLink itself? Or is there a flaw in the example program that I didn't find?
LibraryLink
related questions lately, may I ask what you are working on? $\endgroup$