There is such a thing as a rank-0 MTensor. It's mentioned here. Can we pass such an object to a LibraryFunction? How?

This question is mostly out of curiosity, and not practical need. But it might solve this:

What I tried:

It is possible to LibraryFunctionLoad a function with an argument type of {Integer, 0, "Shared"}. It is possible to load the function like this. But when trying to pass an integer to it, i.e. simply a = 1, then fun[a] instead of a = {1} then fun[a], it gives an error:

LibraryFunction::cfsa: Argument 1 at position 2 should be a machine-size integer.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.