mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 03:27:39 +00:00
Invent *cosmo_dltramp() function
This commit is contained in:
parent
0de6a08988
commit
44a463e4d2
2 changed files with 12 additions and 0 deletions
|
@ -20,6 +20,7 @@ int dlclose(void *);
|
|||
char *cosmo_dlerror(void);
|
||||
void *cosmo_dlopen(const char *, int);
|
||||
void *cosmo_dlsym(void *, const char *);
|
||||
void *cosmo_dltramp(void *);
|
||||
int cosmo_dlclose(void *);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -843,6 +843,17 @@ void *cosmo_dlsym(void *handle, const char *name) {
|
|||
return func;
|
||||
}
|
||||
|
||||
/**
|
||||
* Trampolines foreign function pointer so it can be called safely.
|
||||
*/
|
||||
void *cosmo_dltramp(void *foreign_func) {
|
||||
if (!IsWindows()) {
|
||||
return foreign_thunk_sysv(foreign_func);
|
||||
} else {
|
||||
return foreign_thunk_nt(foreign_func);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes dynamic shared object.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue