guile-devel
[Top][All Lists]
Advanced

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

Making the libguile API explicit


From: Martin Grabmueller
Subject: Making the libguile API explicit
Date: Tue, 05 Jun 2001 20:06:29 +0200

Hello list,

I'd like to raise an issue about the libguile API.  Right now,
everything in libguile which is not static to one object file is part
of the (inofficial) API, since there is nothing preventing a user to
simply call the corresponfing function/use the variable.  In addition,
as not the whole API is documented yet, people often have to look at
the header files to find functions required for their work, thus
possibly using function which were only intended to be used inside
libguile.

Another problem with that is that libguile is right now not easily
portable to native Windows compilers---it is not possible to create a
guile.dll loadable library, because the windows build process
apparently needs information about which functions are exported and
which are not.  And yes, I know that Guile works with cygwin, but I
have been told that at least GNU Serveez needs a working natively
compiled Guile to work under windows.

For these two reason, I propose that we make the API more explicit by
creating a new CPP macro

  SCM_API

which is to be written in front of each function prototype in the
headers.  It will be defined as follows:

#if __GUILE_EXPORT__
# define SCM_API __declspec (dllexport)
#elif __GUILE_IMPORT__
# define SCM_API __declspec (dllimport)
#else
# define SCM_API
#endif

Example (in the header file):

SCM_API extern SCM scm_acons (SCM w, SCM x, SCM y); 

This definition will serve the two purposes described above:

1. Users can check whether functions are defined with SCM_API in the
   headers, and if they are, they can use them.

2. Windows compilers can create proper export lists for Windows.

Not that under non-windows systems, the macro is just for
documentation purposes and does not change the code/compilation
procedure at all.

Are there any objections with that change?  Otherwise, I'd like to
make this change ASAP.

Thanks,
  'martin



reply via email to

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