Windows OLE declarations for thread-local COM initialization and uninitialization.


Imported functions

Stack effects list a C function's parameters with the first parameter on top; see the stack-order rule.

CoInitialize

(pvReserved -- result) Initializes COM on the current thread in single-threaded-apartment mode.

Inputs

  • pvReserved: Natx reserved address; pass 0nx.

Outputs

  • result: Int32 0 when COM is newly initialized on the thread, 1 when it was already initialized in the same mode, or a negative error code on failure.

CoUninitialize

(--) Uninitializes the COM library for the current thread.

Inputs

  • None.

Outputs

  • None.

Remarks

  • Each successful CoInitialize call, including one returning 1, requires one CoUninitialize call on the same thread.

Signature examples

Example: CoInitialize and CoUninitialize signatures

Printing imported names during compilation shows the exact imported signatures.

"control"       use
"windows/ole32" use

{} Int32 {} [
  @CoInitialize printStack _:;
  @CoUninitialize printStack _:;
  0
] "main" exportFunction

Expected Output During Compilation

{pvReserved: Natx;} Int32 {convention: "";} codeRef
{} () {convention: "";} codeRef

See also