Implement thiscall wrapper for MSVC

svn path=/branches/cmake-bringup/; revision=49838
This commit is contained in:
Timo Kreuzer 2010-11-28 10:14:51 +00:00
parent b8702f60f7
commit a916747152
2 changed files with 62 additions and 8 deletions

View file

@ -65,14 +65,7 @@ typedef struct _rtti_object_locator
#define THISCALL_NAME(func) __ASM_NAME("__thiscall_" #func) #define THISCALL_NAME(func) __ASM_NAME("__thiscall_" #func)
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma message ("DEFINE_THISCALL_WRAPPER broken") #include <internal/wine_msc.h>
#define DEFINE_THISCALL_WRAPPER(func,args) \
extern void THISCALL(func)(void);
// __ASM_GLOBAL_FUNC(__thiscall_ ## func, \
// pop eax \
// push ecx \
// push eax \
// jmp __ASM_NAME(#func) __ASM_STDCALL(args) )
#else #else
#define DEFINE_THISCALL_WRAPPER(func,args) \ #define DEFINE_THISCALL_WRAPPER(func,args) \
extern void THISCALL(func)(void); \ extern void THISCALL(func)(void); \
@ -671,6 +664,7 @@ void * __stdcall MSVCRT_type_info_vector_dtor(type_info * _this, unsigned int fl
/* vtables */ /* vtables */
#ifdef __GNUC__
#ifdef _WIN64 #ifdef _WIN64
#define __ASM_VTABLE(name,funcs) \ #define __ASM_VTABLE(name,funcs) \
@ -714,6 +708,16 @@ __ASM_EXCEPTION_VTABLE(__non_rtti_object)
#ifndef __GNUC__ #ifndef __GNUC__
} }
#endif #endif
#endif
#ifdef _MSC_VER
#pragma message ("HAXX!")
const vtable_ptr MSVCRT_exception_vtable;
const vtable_ptr MSVCRT_bad_typeid_vtable;
const vtable_ptr MSVCRT_bad_cast_vtable;
const vtable_ptr MSVCRT___non_rtti_object_vtable;
const vtable_ptr MSVCRT_type_info_vtable;
#endif
/* Static RTTI for exported objects */ /* Static RTTI for exported objects */

View file

@ -0,0 +1,50 @@
#define DEFINE_THISCALL_WRAPPER(func, args) \
void __declspec(naked) __thiscall_ ## func (void) \
{ \
__asm { pop eax } \
__asm { push ecx } \
__asm { push eax } \
__asm { jmp func } \
}
exception * __stdcall MSVCRT_exception_ctor(exception * _this, const char ** name);
exception * __stdcall MSVCRT_exception_ctor_noalloc(exception * _this, char ** name, int noalloc);
exception * __stdcall MSVCRT_exception_copy_ctor(exception * _this, const exception * rhs);
exception * __stdcall MSVCRT_exception_default_ctor(exception * _this);
void __stdcall MSVCRT_exception_dtor(exception * _this);
exception * __stdcall MSVCRT_exception_opequals(exception * _this, const exception * rhs);
void * __stdcall MSVCRT_exception_vector_dtor(exception * _this, unsigned int flags);
void * __stdcall MSVCRT_exception_scalar_dtor(exception * _this, unsigned int flags);
const char * __stdcall MSVCRT_what_exception(exception * _this);
bad_typeid * __stdcall MSVCRT_bad_typeid_copy_ctor(bad_typeid * _this, const bad_typeid * rhs);
bad_typeid * __stdcall MSVCRT_bad_typeid_ctor(bad_typeid * _this, const char * name);
bad_typeid * __stdcall MSVCRT_bad_typeid_default_ctor(bad_typeid * _this);
void __stdcall MSVCRT_bad_typeid_dtor(bad_typeid * _this);
bad_typeid * __stdcall MSVCRT_bad_typeid_opequals(bad_typeid * _this, const bad_typeid * rhs);
void * __stdcall MSVCRT_bad_typeid_vector_dtor(bad_typeid * _this, unsigned int flags);
void * __stdcall MSVCRT_bad_typeid_scalar_dtor(bad_typeid * _this, unsigned int flags);
__non_rtti_object * __stdcall MSVCRT___non_rtti_object_copy_ctor(__non_rtti_object * _this, const __non_rtti_object * rhs);
__non_rtti_object * __stdcall MSVCRT___non_rtti_object_ctor(__non_rtti_object * _this, const char * name);
void __stdcall MSVCRT___non_rtti_object_dtor(__non_rtti_object * _this);
__non_rtti_object * __stdcall MSVCRT___non_rtti_object_opequals(__non_rtti_object * _this, const __non_rtti_object *rhs);
void * __stdcall MSVCRT___non_rtti_object_vector_dtor(__non_rtti_object * _this, unsigned int flags);
void * __stdcall MSVCRT___non_rtti_object_scalar_dtor(__non_rtti_object * _this, unsigned int flags);
bad_cast * __stdcall MSVCRT_bad_cast_ctor(bad_cast * _this, const char ** name);
bad_cast * __stdcall MSVCRT_bad_cast_copy_ctor(bad_cast * _this, const bad_cast * rhs);
bad_cast * __stdcall MSVCRT_bad_cast_ctor_charptr(bad_cast * _this, const char * name);
bad_cast * __stdcall MSVCRT_bad_cast_default_ctor(bad_cast * _this);
void __stdcall MSVCRT_bad_cast_dtor(bad_cast * _this);
bad_cast * __stdcall MSVCRT_bad_cast_opequals(bad_cast * _this, const bad_cast * rhs);
void * __stdcall MSVCRT_bad_cast_vector_dtor(bad_cast * _this, unsigned int flags);
void * __stdcall MSVCRT_bad_cast_scalar_dtor(bad_cast * _this, unsigned int flags);
int __stdcall MSVCRT_type_info_opequals_equals(type_info * _this, const type_info * rhs);
int __stdcall MSVCRT_type_info_opnot_equals(type_info * _this, const type_info * rhs);
int __stdcall MSVCRT_type_info_before(type_info * _this, const type_info * rhs);
void __stdcall MSVCRT_type_info_dtor(type_info * _this);
const char * __stdcall MSVCRT_type_info_name(type_info * _this);
const char * __stdcall MSVCRT_type_info_raw_name(type_info * _this);
void * __stdcall MSVCRT_type_info_vector_dtor(type_info * _this, unsigned int flags);
#define __ASM_VTABLE(name,funcs)
//void *MSVCRT_ ## name ##_vtable[] =