ptr = libpointer()
ptr = libpointer(datatype)
ptr = libpointer(datatype, value)
| Parameter | Description |
|---|---|
| datatype | a string: data type. |
| value | a nelson variable compatible with datatype. |
| Parameter | Description |
|---|---|
| ptr | a libpointer handle. |
This is an advanced feature to manipulate C pointers.
ptr = libpointer() creates an NULL pointer.
p = libpointer('int8Ptr', int8([3 4]));
p.isNull()
p.DataType
p.Value
NLSDYNAMIC_LINK_IMPEXP double *multiplicationDoubleByReference(double *x)
{
*x *= 2;
return x;
}
x = 133.3;
xPtr = libpointer('doublePtr', x);
path_ref = modulepath('dynamic_link', 'builtin');
lib = dlopen(path_ref);
f = dlsym(lib, 'multiplicationDoubleByReference', 'libpointer', {'doublePtr'});
[r1, r2] = dlcall(f, xPtr);
r2
% r1 is an libpointer of type '' (voidPointer) and it need to be change type and size.
r1.setdatatype('doublePtr');
r1.reshape(1, 1);
get(r1)
| Version | Description |
|---|---|
| 1.0.0 | initial version |