guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Compiling and using guile with Visual Studio


From: Remacle, F \(Francois\)
Subject: Compiling and using guile with Visual Studio
Date: Mon, 16 Apr 2007 11:11:36 +0100

Hi Everyone,

I have been compiling guile with visual studio 2003, and after some
efforts (mainly to define properly the way to use dynamic linking with
the function LoadLibrary, FreeLibrary etc... from windows) I have set it
up properly  and can run it and type scheme stuff in it without
troubles.

However when using the dynamic linking (the things defined in dynl.c), I
always face some problems. I have tried two guile modules: guile-arith
and guile-gtk and both fails when being loaded dynamically.

To see it it was due to the nullthread thing I have been trying the
pthread-win32 library which is a port of pthread to windows. However
when using this I need to tweak a little scmsigs.c because visual studio
does not have sigset_t or sigfullset(). When doing that I can not start
up guile and it crashes when flushing some buffer.

I was wondering if anyone would have some knowledge or experience in
building guile/pthread-win32 with visual studio? (see details of failure
below for the dynamic loading thing.)

Thanks a lot

Francois Remacle

PS: Details of the problem encountered
When trying to load guile-gtk I have a failure here:

---------------------------------------------------------
scm_make_smob_type (char const *name, size_t size)
#define FUNC_NAME "scm_make_smob_type"
{
  long new_smob;

--->  SCM_CRITICAL_SECTION_START;
  new_smob = scm_numsmob;
  if (scm_numsmob != MAX_SMOB_COUNT)
    ++scm_numsmob;
  SCM_CRITICAL_SECTION_END;
---------------------------------------------------------

And when trying to load guile-arith I have a failure here:

---------------------------------------------------------
static void increase_mtrigger (size_t size, const char *what)
{
  size_t mallocated = 0;
  int overflow = 0, triggered = 0;

  scm_i_pthread_mutex_lock (&scm_i_gc_admin_mutex);
  if (ULONG_MAX - size < scm_mallocated)
    overflow = 1;
  else
    {
      scm_mallocated += size;
      mallocated = scm_mallocated;
      if (scm_mallocated > scm_mtrigger)
        triggered = 1;
    }
  scm_i_pthread_mutex_unlock (&scm_i_gc_admin_mutex);

  if (overflow)
    scm_memory_error ("Overflow of scm_mallocated: too much memory in
use.");

  /*
    A program that uses a lot of malloced collectable memory (vectors,
    strings), will use a lot of memory off the cell-heap; it needs to
    do GC more often (before cells are exhausted), otherwise swapping
    and malloc management will tie it down.
   */
  if (triggered)
    {
      unsigned long prev_alloced;
      float yield;
      
      scm_i_scm_pthread_mutex_lock (&scm_i_sweep_mutex);
      scm_gc_running_p = 1;
      
      prev_alloced  = mallocated;
----> scm_i_gc (what);
      scm_i_sweep_all_segments ("mtrigger");

      yield = (((float) prev_alloced - (float) scm_mallocated)
               / (float) prev_alloced);
      
      scm_gc_malloc_yield_percentage = (int) (100  * yield);
----------------------------------------------------------------







reply via email to

[Prev in Thread] Current Thread [Next in Thread]