Api conventions
When using EasyAR Sense APIs, certain conventions must be followed; otherwise, it may cause program crashes, memory leaks, or other abnormal behaviors.
Supported languages
EasyAR Sense supports the following languages:
C
Supports C99 and Visual C++, gcc, clang
C++
Supports C++17 and Visual C++, gcc, clang
The only C++17 feature used is std::optional. To use in C++11 environments, employ optional lite, replacing std::optional with nonstd::optional in interface header files and changing
#include <optional>to#include "nonstd/optional.hpp"Java
Android platform only, supports Java SE 6 and above
Kotlin
Android platform only
Objective-C
iOS/macOS/visionOS platforms only
Swift
Supports Swift 4.2 and above
C#
Supports .Net Framework 3.5+, .Net Core, .Net 5+, Mono, Unity/Mono, Unity/IL2CPP
Thread safety model
For each class, unless otherwise specified, its static members are thread-safe.
For each class, unless otherwise specified, its instance members are thread-safe when externally locked, but not thread-safe without locking.
For each class, unless otherwise specified, its destructor can be called from any thread after other calls to the object have finished, and is thread-safe at that time.
Memory model
EasyAR Sense internally uses C++'s std::shared_ptr for reference counting. There is a fundamental incompatibility between reference counting and garbage collection, preventing seamless conversion.
C, C#, Java/Kotlin
Manual reference counting is required. Use dispose to release references to held objects. Use clone to create a new reference from an existing one.
Note that parameters passed into EasyAR Sense callbacks are automatically released after the callback ends. If retention is needed, clone must be used. This automatic release supports callbacks without any internal logic.
Note that using EasyAR Sense objects within callbacks passed to EasyAR Sense may cause circular references. Treat them as resources (e.g., files, OS handles) requiring manual release to prevent memory leaks.
C++, Objective-C, Swift
Use the language's built-in reference counting.
Note that using EasyAR Sense objects within callbacks passed to EasyAR Sense may cause circular references. Use reference capturing, std::weak_ptr, etc., appropriately.
String encoding
String encoding used in interfaces is as follows:
C, C++
UTF-8
Java, Kotlin, Objective-C, C#
UTF-16
Swift
UTF-16 or UTF-8, refer to Swift documentation