feat: finish cdylib ffi and improve ffi C header
This commit is contained in:
@@ -2,28 +2,50 @@
|
||||
#ifndef __WFASSOC_H__
|
||||
#define __WFASSOC_H__
|
||||
|
||||
#include <stdarg.h>
|
||||
#ifdef __cplusplus
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#else // __cplusplus
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
typedef const char *CStyleString;
|
||||
|
||||
typedef uint64_t Token;
|
||||
|
||||
typedef uint32_t Scope;
|
||||
#define SCOPE_USER 0u
|
||||
#define SCOPE_SYSTEM 1u
|
||||
|
||||
typedef uint32_t View;
|
||||
#define VIEW_USER 0u
|
||||
#define VIEW_SYSTEM 1u
|
||||
#define VIEW_HYBRID 2u
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
using CStyleString = const char*;
|
||||
using Token = uint64_t;
|
||||
using HICON = void*;
|
||||
#else // __cplusplus
|
||||
typedef const char *CStyleString;
|
||||
typedef uint64_t Token;
|
||||
typedef void *HICON;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
enum class Scope : uint32_t {
|
||||
User = 0u,
|
||||
System = 1u
|
||||
};
|
||||
enum class View : uint32_t {
|
||||
User = 0u,
|
||||
System = 1u,
|
||||
Hybrid = 2u
|
||||
};
|
||||
#else // __cplusplus
|
||||
typedef uint32_t Scope;
|
||||
static const Scope SCOPE_USER = 0u;
|
||||
static const Scope SCOPE_SYSTEM = 1u;
|
||||
typedef uint32_t View;
|
||||
static const View VIEW_USER = 0u;
|
||||
static const View VIEW_SYSTEM = 1u;
|
||||
static const View VIEW_HYBRID = 2u;
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace wfassoc {
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
@@ -35,6 +57,8 @@ CStyleString WFGetLastError(void);
|
||||
|
||||
bool WFHasPrivilege(void);
|
||||
|
||||
Token WFInvalidToken(void);
|
||||
|
||||
bool WFSchemaCreate(Token *out_schema);
|
||||
|
||||
bool WFSchemaDestroy(Token in_schema);
|
||||
@@ -67,18 +91,27 @@ bool WFProgramCreate(Token in_schema, Token *out_program);
|
||||
|
||||
bool WFProgramDestroy(Token in_program);
|
||||
|
||||
bool WFProgramRegister(Token in_program, uint32_t in_scope);
|
||||
bool WFProgramRegister(Token in_program, Scope in_scope);
|
||||
|
||||
bool WFProgramUnregister(Token in_program, uint32_t in_scope);
|
||||
bool WFProgramUnregister(Token in_program, Scope in_scope);
|
||||
|
||||
bool WFProgramIsRegistered(Token in_program, uint32_t in_scope, bool *out_is_registered);
|
||||
bool WFProgramIsRegistered(Token in_program, Scope in_scope, bool *out_is_registered);
|
||||
|
||||
bool WFProgramLinkExt(Token in_program, uint32_t in_scope, size_t in_index);
|
||||
bool WFProgramLinkExt(Token in_program, Scope in_scope, size_t in_index);
|
||||
|
||||
bool WFProgramUnlinkExt(Token in_program, uint32_t in_scope, size_t in_index);
|
||||
bool WFProgramUnlinkExt(Token in_program, Scope in_scope, size_t in_index);
|
||||
|
||||
bool WFProgramQueryExt(Token in_program, View in_view, size_t in_index, Token *out_ext_status);
|
||||
|
||||
bool WFExtStatusDestroy(Token in_ext_status);
|
||||
|
||||
bool WFExtStatuGetName(Token in_ext_status, CStyleString *out_name);
|
||||
|
||||
bool WFExtStatuGetIcon(Token in_ext_status, HICON *out_icon);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
} // namespace wfassoc
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // __WFASSOC_H__
|
||||
#endif // __WFASSOC_H__
|
||||
|
||||
Reference in New Issue
Block a user