arnoudb
(Arnoud Buzing)
January 23, 2014, 10:43pm
1
This is a list of a fully functional LibraryLink examples, starting with the bare minimum to more complicated cases:
Doing nothing with LibraryLink -- Explains how to write a minimal example in LibraryLink that takes no arguments and returns nothing
Saying hello with LibraryLink -- Explains how to return a value from a LibraryLink function
Sending greetings from LibraryLink -- Explains how to pass in a value to a LibraryLink function
Squaring integers with LibraryLink -- Explains how to write a basic arithmetic function with LibraryLink
Writing a boolean function with LibraryLink -- Explains how to write a function that returns True or False
Calculating the mean value of a list with LibraryLink -- Explains how to pass lists for a LibraryLink function
Creating a matrix with LibraryLink -- Explains how to return a matrix from a LibraryLink function
Working with complex numbers in LibraryLink
Working with multiple functions in LibraryLink
LibraryLink examples which use WolframLink:
Hello World revisited using WolframLink in LibraryLink
Working with a variable number of arguments in LibraryLink
11 Likes
00iassi
(Michael Jasi)
January 22, 2020, 11:16am
2
Hello Arnoud,
thanks for these very helpful examples. Unfortunately, there is a case missing:
I would like to pass several MTensors as a result via LibraryLink.
Say, I have a real matrix and a list of integers that I want to pass on.
Thanks,
Michael
arnoudb
(Arnoud Buzing)
January 22, 2020, 2:47pm
3
Not sure how to do this off-hand, but I will ask some people who might know.
Another good place to look for a possible answer is the Q&A site called StackExchange:
arnoudb
(Arnoud Buzing)
January 22, 2020, 2:48pm
4
A possible answer here:
https://mathematica.stackexchange.com/questions/31545/returning-multiple-results-from-a-librarylink-function
With a mirror post here:
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 c…
arnoudb
(Arnoud Buzing)
January 27, 2020, 2:53pm
5
Code is also available in this GitHub repository:
Creating dynamic libraries that can be loaded in the Wolfram Language via `LibraryLink`
1 Like