4

Can I specify the output type when using calllib? My problem is MATLAB is automatically converting my output to a double even though I need an int64 and am losing needed precision.

Example

I have the following function defined in my_header.h

__int64 my_function(int arg1);

I can call the function like this:

loadlibrary('my_library', 'my_header.h')
output = calllib('my_library', 'my_function', arg1)

But then output is a double and I am losing needed precision.

What I tried

output = int64(calllib('my_library', 'my_function', arg1))

as well as

output = zeros(1, 'int64')
output(1) = calllib('my_library', 'my_function', arg1)

but these just convert my double to int64 after it has already lost the needed precision.

J. Doe
  • 41
  • 1
  • This problem will become even more involved with the new HDF5 library version 1.10.x, where handles of the type hid_t have become a 64 bit signed integer. Future Mablab version will not be able to use this HDF5 version until calllib is adapted accordingly to return 64 bit integers to full precision. – Hoanzn Apr 17 '18 at 11:35

0 Answers0