mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 03:30:27 +02:00
For MinGW hide exported struct variables behind pointers
MinGW apparently can't export/import struct variables from/to a DLL, so wrap the ones needed by inline.h in exported/imported pointer variables. All of the following changes apply to a MinGW build only. * libguile/gc-freelist.c (scm_i_master_freelist_ptr, scm_i_master_freelist2_ptr): New API variables. * libguile/gc.h (scm_i_freelist_ptr, scm_i_freelist2_ptr, scm_i_master_freelist_ptr, scm_i_master_freelist2_ptr): New global variable declarations. * libguile/inline.h (scm_cell): Use scm_i_freelist_ptr and scm_i_master_freelist_ptr instead of scm_i_freelist and scm_i_master_freelist. (scm_double_cell): Use scm_i_freelist2_ptr and scm_i_master_freelist2_ptr instead of scm_i_freelist2 and scm_i_master_freelist2. * libguile/threads.c (scm_i_freelist_ptr, scm_i_freelist2_ptr): New global variables.
This commit is contained in:
parent
954d46413f
commit
9d9a58e184
4 changed files with 30 additions and 2 deletions
|
@ -29,7 +29,10 @@
|
|||
|
||||
scm_t_cell_type_statistics scm_i_master_freelist;
|
||||
scm_t_cell_type_statistics scm_i_master_freelist2;
|
||||
|
||||
#ifdef __MINGW32__
|
||||
scm_t_cell_type_statistics *scm_i_master_freelist_ptr = &scm_i_master_freelist;
|
||||
scm_t_cell_type_statistics *scm_i_master_freelist2_ptr = &scm_i_master_freelist2;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -276,7 +276,12 @@ SCM_API scm_i_pthread_key_t scm_i_freelist;
|
|||
SCM_API scm_i_pthread_key_t scm_i_freelist2;
|
||||
SCM_API struct scm_t_cell_type_statistics scm_i_master_freelist;
|
||||
SCM_API struct scm_t_cell_type_statistics scm_i_master_freelist2;
|
||||
|
||||
#ifdef __MINGW32__
|
||||
SCM_API scm_i_pthread_key_t *scm_i_freelist_ptr;
|
||||
SCM_API scm_i_pthread_key_t *scm_i_freelist2_ptr;
|
||||
SCM_API struct scm_t_cell_type_statistics *scm_i_master_freelist_ptr;
|
||||
SCM_API struct scm_t_cell_type_statistics *scm_i_master_freelist2_ptr;
|
||||
#endif
|
||||
|
||||
SCM_API unsigned long scm_gc_cells_swept;
|
||||
SCM_API unsigned long scm_gc_cells_collected;
|
||||
|
|
|
@ -109,10 +109,18 @@ SCM
|
|||
scm_cell (scm_t_bits car, scm_t_bits cdr)
|
||||
{
|
||||
SCM z;
|
||||
#ifdef __MINGW32__
|
||||
SCM *freelist = SCM_FREELIST_LOC (*scm_i_freelist_ptr);
|
||||
#else
|
||||
SCM *freelist = SCM_FREELIST_LOC (scm_i_freelist);
|
||||
#endif
|
||||
|
||||
if (scm_is_null (*freelist))
|
||||
#ifdef __MINGW32__
|
||||
z = scm_gc_for_newcell (scm_i_master_freelist_ptr, freelist);
|
||||
#else
|
||||
z = scm_gc_for_newcell (&scm_i_master_freelist, freelist);
|
||||
#endif
|
||||
else
|
||||
{
|
||||
z = *freelist;
|
||||
|
@ -180,10 +188,18 @@ scm_double_cell (scm_t_bits car, scm_t_bits cbr,
|
|||
scm_t_bits ccr, scm_t_bits cdr)
|
||||
{
|
||||
SCM z;
|
||||
#ifdef __MINGW32__
|
||||
SCM *freelist = SCM_FREELIST_LOC (*scm_i_freelist2_ptr);
|
||||
#else
|
||||
SCM *freelist = SCM_FREELIST_LOC (scm_i_freelist2);
|
||||
#endif
|
||||
|
||||
if (scm_is_null (*freelist))
|
||||
#ifdef __MINGW32__
|
||||
z = scm_gc_for_newcell (scm_i_master_freelist2_ptr, freelist);
|
||||
#else
|
||||
z = scm_gc_for_newcell (&scm_i_master_freelist2, freelist);
|
||||
#endif
|
||||
else
|
||||
{
|
||||
z = *freelist;
|
||||
|
|
|
@ -1680,6 +1680,10 @@ scm_dynwind_critical_section (SCM mutex)
|
|||
/*** Initialization */
|
||||
|
||||
scm_i_pthread_key_t scm_i_freelist, scm_i_freelist2;
|
||||
#ifdef __MINGW32__
|
||||
scm_i_pthread_key_t *scm_i_freelist_ptr = &scm_i_freelist;
|
||||
scm_i_pthread_key_t *scm_i_freelist2_ptr = &scm_i_freelist2;
|
||||
#endif
|
||||
scm_i_pthread_mutex_t scm_i_misc_mutex;
|
||||
|
||||
#if SCM_USE_PTHREAD_THREADS
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue