Added support API for class objects.
This commit is contained in:
Родитель
30fb205ba0
Коммит
1021ccad1f
|
@ -94,8 +94,8 @@ static GString* get_current_executable_path()
|
|||
|
||||
return (ret > 0) ? g_string_new(pathbuf) : 0;
|
||||
#elif defined(_WIN32)
|
||||
HMODULE hModule = GetModuleHandleW(0);
|
||||
CHAR pathbuf[MAX_PATH];
|
||||
HMODULE hModule = GetModuleHandleW(0);
|
||||
CHAR pathbuf[MAX_PATH];
|
||||
DWORD ret = GetModuleFileNameA(hModule, pathbuf, MAX_PATH);
|
||||
|
||||
return (ret > 0) ? g_string_new(pathbuf) : 0;
|
||||
|
@ -184,4 +184,12 @@ void mono_m2n_error(mono_m2n_error_t error)
|
|||
return;
|
||||
|
||||
g_error_report_hook(error);
|
||||
}
|
||||
|
||||
void* mono_m2n_create_object(MonoObject* instance)
|
||||
{
|
||||
MonoEmbedObject* object = g_new(MonoEmbedObject, 1);
|
||||
object->_class = mono_object_get_class(instance);
|
||||
object->_handle = mono_gchandle_new(instance, /*pinned=*/false);
|
||||
return object;
|
||||
}
|
|
@ -64,6 +64,7 @@ typedef struct _GString GString;
|
|||
typedef struct _MonoDomain MonoDomain;
|
||||
typedef struct _MonoException MonoException;
|
||||
typedef struct _MonoClass MonoClass;
|
||||
typedef struct _MonoObject MonoObject;
|
||||
|
||||
MONO_M2N_BEGIN_DECLS
|
||||
|
||||
|
@ -164,4 +165,19 @@ typedef struct
|
|||
GArray* array;
|
||||
} MonoEmbedArray;
|
||||
|
||||
MONO_M2N_END_DECLS
|
||||
/**
|
||||
* Objects
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
MonoClass* _class;
|
||||
uint32_t _handle;
|
||||
} MonoEmbedObject;
|
||||
|
||||
/**
|
||||
* Creates an support object from a Mono object instance.
|
||||
*/
|
||||
void* mono_m2n_create_object(MonoObject* instance);
|
||||
|
||||
MONO_M2N_END_DECLS
|
||||
|
|
Загрузка…
Ссылка в новой задаче