Message Boards Message Boards


Returning multiple inhomogeneous values from a LibraryLink function

Posted 10 years ago
0 Replies
3 Total Likes
What is the proper way to return multiple values of different types from a LibraryLink function?

Do I need to use a MathLink connection to send the list of values?  If I do this, and I return multiple large tensors, is there likely going to be a significant performance hit?

Would you recommend that I use separate LibraryLink functions for retrieving the different tensors, with the cost of having to do manual memory management?  It would work like this: there would be a function that does the calculation and stores all results in memory, but doesn't return them to Mathematica.  There would be separate functions for retrieving each type of result.  Finally, there would be a function for freeing the memory.  I'm not sure this is worth doing just to avoid a possibly minor performance hit.

Cross posted on Mathematica.SE

Update: I consider this resolved based on the Mathematica.SE answers.
POSTED BY: Szabolcs Horvát
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract