C-Language Wrappers

Description

The CTR-SDK APIs are mostly written in C++. C++ APIs cannot be called directly from C-language files.

The CTR-SDK therefore provides wrappers that allow you to call the C++ APIs from C source files.

Mutex Example

In C++, you would use the nn::os::Mutex class to use mutexes. The mutex class maintains mutex objects internally.

The names of the wrappers that allow this class to be used in C begin with nnosMutex, as shown in the examples below. These functions have a 1:1 correspondence with the C++ methods.

nnosMutexInitializenn::os::Mutex::Initialize
nnosMutexLocknn::os::Mutex::Lock
nnosMutexTryLocknn::os::Mutex::TryLock
nnosMutexUnlocknn::os::Mutex::Unlock
nnosMutexInitializenn::os::Mutex::Initialize
To learn more about the C wrapper functions, see the explanations for the corresponding class methods.

The nnosMutex structure, the data type that stores mutex objects in C, is an exception. This structure is actually a class instance under the hood, so it cannot be referenced directly from the C language.

List

See the "Modules" page for a list of modules that can be used in C and C++ code respectively.

Revision History

2010/01/07
Initial version.

CONFIDENTIAL