2 mac_uninitialize – ElmoMC Multi-Axis Motion Controller-Maestro User Manual

Page 109

Advertising
background image

Return Value:

int - initialization status:

0 OK;
1

The API library is already initialized;

2

The COM library is already initialized on this thread;

3

A previous COM initialization specified a different apartment model for this
thread;

4

The COM library initialization failed;

5

The MAS Events mechanism initialization failed;

Use MAC_GetLastError to retrieve the error string.

Remarks:

MAC_Initialize() can initializes the COM library for use by the calling thread, sets the
thread's concurrency model, and creates a new apartment for the thread if one is required.
There are two types of apartments: single-threaded apartments, and multithreaded
apartments.

Single-threaded Apartments—Single-threaded apartments consist of exactly one thread, so all

COM objects that live in a single-threaded apartment can receive method calls only from the
one thread that belongs to that apartment. All method calls to a COM object in a single-
threaded apartment are synchronized with the windows message queue for the single-
threaded apartment's thread. A process with a single thread of execution is simply a special
case of this model.

Multithreaded Apartments—Multithreaded apartments consist of one or more threads, so all

COM objects that live in a multithreaded apartment can receive method calls directly from
any of the threads that belong to the multithreaded apartment. Threads in a multithreaded
apartment use a model called free-threading. Calls to COM objects in a multithreaded
apartment are synchronized by the objects themselves.

Sample:

int nOk = MAC_Initialize( COM_INIT_SINGLETHREADED, FALSE );

6.2

MAC_Uninitialize

This function enables the user to uninitialize Multi Axes Supervisor API Library.

Syntax:

void MAC_Uninitialize();

Sample:

MAC_Uninitialize()

;

Maestro

Software Manual

The Maestro API

MAN-MASSW (Ver. Q)

6-2

Advertising