Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

libpointer

Pointer object for use with shared library

Syntax

  • p = libpointer
  • p = libpointer(DataType)
    example
  • p = libpointer(DataType,Value)

Description

p = libpointer creates NULL pointer p of type voidPtr.

example

p = libpointer(DataType) creates NULL pointer of specified DataType.

p = libpointer(DataType,Value) creates pointer initialized to a copy of Value.

Examples

collapse all

p = libpointer('string');

Related Examples

Input Arguments

collapse all

Type of pointer, specified as a character vector, of any MATLAB® numeric type, structure defined in the library, or enumeration defined in the library. For a list of valid MATLAB numeric types, refer to these tables in C and MATLAB Equivalent Types.

  • MATLAB Primitive Types

  • MATLAB Extended Types

Example: 'int16Ptr'

Data Types: char

Value, specified as any valid value for given type.

Limitations

  • Use with libraries that are loaded using the loadlibrary function.

More About

collapse all

Tips

  • This is an advanced feature for experienced C programmers. MATLAB automatically converts data passed to and from external library functions to the data type expected by the external function. Use a lib.pointer object instead of automatic conversion in the following situations.

    • You want to modify the data in the input arguments.

    • You are passing large amounts of data, and you want to control when MATLAB makes copies of the data.

    • The library stores and uses the pointer for a period of time so you want the MATLAB function to control the lifetime of the lib.pointer object.

Introduced before R2006a

Was this topic helpful?