Products & Services Solutions Academia Support User Community Company

Learn more about SimMechanics Link   

Programming Custom Exporter Modules with the SimMechanics Link API

Including, Linking to, and Calling the API Function Library

In the following procedures, replace:

Including and Using the API Header File

To write your C/C++ custom exporter module, use the C header file located in matlabroot/toolbox/physmod/smlink/api/include/.

This header file contains the function definitions that you follow to call the SimMechanics Link API functions from your module. Include this header file in your module C/C++ source code.

Compiling and Linking the Custom Exporter Module

In addition to linking your custom module to the SimMechanics Link API, consult your CAD platform's API documentation to determine requirements for linking to the platform's API.

On Windows Platforms.   After you compile your module, link it to the binary API function library located in matlabroot\toolbox\physmod\smlink\api\lib\.

On UNIX, LINUX, and Mac Platforms.   After you compile your module, link it to the binary API function library:

matlabroot/bin/ARCH/libmwpmi_api.OS-SPECIFIC-EXTENSION

OS-SPECIFIC-EXTENSION is the API file extension specific to your operating system.

Executing the Custom Exporter Module

To determine if you need to include your CAD platform API on the path, consult your CAD platform API documentation.

On Windows.   Before you start execution of the module, verify that the folder matlabroot\bin\ARCH\ is on the path.

On UNIX, LINUX, and Mac Platforms.   Before you start execution of the module, verify that the folder matlabroot/bin/ARCH/ is included in the system path environment variable LD_LIBRARY_PATH.

Locating API Code Examples

You can find API examples in this folder:

matlabroot/toolbox/physmod/smlink/api/example/

The subfolder, cadapi_example/, contains CAD-based examples.

A Custom Exporter Module Example

The folder matlabroot/toolbox/physmod/smlink/api/example/cadapi_example/ contains a simple C++ example of a custom module based on the API, cadapi_example.cpp.

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS