[Top][All Lists]

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

DLLs and exported symbols...

From: Lars J. Aas
Subject: DLLs and exported symbols...
Date: Sat, 18 Nov 2000 03:04:53 +0100
User-agent: Mutt/1.2.5i

When creating Windows32 .DLLs, you must explicitly specify each
symbol that is to be exported in the .DLLs API.  One way to do
this is to precede every public declaration with the string
`__declspec(dllexport)'.  Every function, every data member...
Only while building the .DLL, though.  When you compile against
the .DLL, that string must not precede the symbols.

One of the most common ways to do this is to use a define that
contains that string when compiling the library, and which is
empty when you're a client.  I propose having a new define
`SCM_PUBLIC' be the conditional container of that string, and
adding the following code to libguile/__scm.h

| #define SCM_PUBLIC __declspec(dllexport)
| #endif
| #ifndef SCM_PUBLIC
| #define SCM_PUBLIC
| #endif

Then, in e.g. init.h, instead of

| extern int scm_initialized_p;
| extern void scm_init_guile (void);
| extern void scm_boot_guile (int argc, char **argv,
|                             void (*main_func) (void *closure,
|                                                int argc,
|                                                char **argv),
|                             void *closure);
| extern void scm_load_startup_files (void);

you get

| SCM_PUBLIC extern int scm_initialized_p;
| SCM_PUBLIC extern void scm_init_guile (void);
| SCM_PUBLIC extern void scm_boot_guile (int argc, char **argv,
|                                        void (*main_func) (void *closure,
|                                                           int argc,
|                                                           char **argv),
|                                        void *closure);
| SCM_PUBLIC extern void scm_load_startup_files (void);

How do you guys like this?

  Lars J

reply via email to

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