Declare unified module interface and use it in modules

This fixes loading modules compiled with a C++ compiler. Remote thandle
type, it's unused. Use tintptr for module data. Don't cast pointers to
long, they won't fit on Win64.
master
Pavel Roskin 8 years ago
parent 2c13ef5c6d
commit ace7d2c822

@ -113,7 +113,6 @@ typedef __int64 tbus;
#else
typedef long tbus;
#endif
typedef tbus thandle;
typedef tbus tintptr;
/* wide char, socket */
#if defined(_WIN32)
@ -137,4 +136,14 @@ typedef signed long long tsi64;
#define printflike(arg_format, arg_first_check)
#endif
/* module interface */
#ifdef __cplusplus
extern "C" {
#endif
tintptr mod_init();
int mod_exit(tintptr);
#ifdef __cplusplus
}
#endif
#endif

@ -81,7 +81,7 @@ lib_mod_set_param(struct mod *mod, const char *name, char *value)
}
/******************************************************************************/
struct mod *EXPORT_CC
tintptr EXPORT_CC
mod_init(void)
{
struct mod *mod;
@ -89,20 +89,22 @@ mod_init(void)
mod = (struct mod *)g_malloc(sizeof(struct mod), 1);
mod->size = sizeof(struct mod);
mod->version = CURRENT_MOD_VER;
mod->handle = (long)mod;
mod->handle = (tintptr) mod;
mod->mod_connect = lib_mod_connect;
mod->mod_start = lib_mod_start;
mod->mod_event = lib_mod_event;
mod->mod_signal = lib_mod_signal;
mod->mod_end = lib_mod_end;
mod->mod_set_param = lib_mod_set_param;
return mod;
return (tintptr) mod;
}
/******************************************************************************/
int EXPORT_CC
mod_exit(struct mod *mod)
mod_exit(tintptr handle)
{
struct mod *mod = (struct mod *) handle;
if (mod == 0)
{
return 0;

@ -1955,7 +1955,7 @@ lfreerdp_verify_certificate(freerdp *instance, char *subject, char *issuer,
}
/******************************************************************************/
struct mod *EXPORT_CC
tintptr EXPORT_CC
mod_init(void)
{
struct mod *mod;
@ -1968,7 +1968,7 @@ mod_init(void)
mod->vmaj, mod->vmin, mod->vrev));
mod->size = sizeof(struct mod);
mod->version = CURRENT_MOD_VER;
mod->handle = (tbus)mod;
mod->handle = (tintptr) mod;
mod->mod_connect = lxrdp_connect;
mod->mod_start = lxrdp_start;
mod->mod_event = lxrdp_event;
@ -1995,13 +1995,15 @@ mod_init(void)
lcon->modi = mod;
LLOGLN(10, ("mod_init: mod %p", mod));
return mod;
return (tintptr) mod;
}
/******************************************************************************/
int EXPORT_CC
mod_exit(struct mod *mod)
mod_exit(tintptr handle)
{
struct mod *mod = (struct mod *) handle;
LLOGLN(0, ("mod_exit:"));
if (mod == 0)

@ -318,7 +318,7 @@ lib_mod_check_wait_objs(struct mod *mod)
}
/******************************************************************************/
struct mod *EXPORT_CC
tintptr EXPORT_CC
mod_init(void)
{
struct mod *mod;
@ -327,7 +327,7 @@ mod_init(void)
mod = (struct mod *)g_malloc(sizeof(struct mod), 1);
mod->size = sizeof(struct mod);
mod->version = CURRENT_MOD_VER;
mod->handle = (long)mod;
mod->handle = (tintptr) mod;
mod->mod_connect = lib_mod_connect;
mod->mod_start = lib_mod_start;
mod->mod_event = lib_mod_event;
@ -338,13 +338,15 @@ mod_init(void)
mod->mod_check_wait_objs = lib_mod_check_wait_objs;
mod->rdp_layer = rdp_rdp_create(mod);
DEBUG(("out mod_init"));
return mod;
return (tintptr) mod;
}
/******************************************************************************/
int EXPORT_CC
mod_exit(struct mod *mod)
mod_exit(tintptr handle)
{
struct mod *mod = (struct mod *) handle;
DEBUG(("in mod_exit"));
g_free(mod);
DEBUG(("out mod_exit"));

@ -1465,7 +1465,7 @@ lib_mod_check_wait_objs(struct vnc *v)
}
/******************************************************************************/
struct vnc *EXPORT_CC
tintptr EXPORT_CC
mod_init(void)
{
struct vnc *v;
@ -1474,7 +1474,7 @@ mod_init(void)
/* set client functions */
v->size = sizeof(struct vnc);
v->version = CURRENT_MOD_VER;
v->handle = (long)v;
v->handle = (tintptr) v;
v->mod_connect = lib_mod_connect;
v->mod_start = lib_mod_start;
v->mod_event = lib_mod_event;
@ -1483,13 +1483,14 @@ mod_init(void)
v->mod_set_param = lib_mod_set_param;
v->mod_get_wait_objs = lib_mod_get_wait_objs;
v->mod_check_wait_objs = lib_mod_check_wait_objs;
return v;
return (tintptr) v;
}
/******************************************************************************/
int EXPORT_CC
mod_exit(struct vnc *v)
mod_exit(tintptr handle)
{
struct vnc *v = (struct vnc *) handle;
log_message(LOG_LEVEL_DEBUG, "VNC mod_exit");
if (v == 0)

@ -1552,7 +1552,7 @@ lib_mod_frame_ack(struct mod *amod, int flags, int frame_id)
}
/******************************************************************************/
struct mod *EXPORT_CC
tintptr EXPORT_CC
mod_init(void)
{
struct mod *mod;
@ -1560,7 +1560,7 @@ mod_init(void)
mod = (struct mod *)g_malloc(sizeof(struct mod), 1);
mod->size = sizeof(struct mod);
mod->version = CURRENT_MOD_VER;
mod->handle = (tbus)mod;
mod->handle = (tintptr) mod;
mod->mod_connect = lib_mod_connect;
mod->mod_start = lib_mod_start;
mod->mod_event = lib_mod_event;
@ -1570,13 +1570,15 @@ mod_init(void)
mod->mod_get_wait_objs = lib_mod_get_wait_objs;
mod->mod_check_wait_objs = lib_mod_check_wait_objs;
mod->mod_frame_ack = lib_mod_frame_ack;
return mod;
return (tintptr) mod;
}
/******************************************************************************/
int EXPORT_CC
mod_exit(struct mod *mod)
mod_exit(tintptr handle)
{
struct mod *mod = (struct mod *) handle;
if (mod == 0)
{
return 0;

Loading…
Cancel
Save