octave-maintainers
[Top][All Lists]
Advanced

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

Re: Patch to Octave shutdown procedures


From: Michael Goffioul
Subject: Re: Patch to Octave shutdown procedures
Date: Wed, 20 May 2009 10:41:43 +0100

On Wed, May 20, 2009 at 10:18 AM, Jaroslav Hajek <address@hidden> wrote:
> OK. Can you please give me a short clue about what the
> OCTAVE_API/OCTINTERP_API tags are all about and what they should do? I
> have no clue, so I'd like to at least know what I'm doing.

They add context-dependent decoration to the target symbols. Under Win32, it
tags symbols with __declspec(dllexport) when the DLL is compiled, and with
__declspec(dllimport) when the DLL is used. This is needed as:
1) MSVC does not export all symbols by default
2) exporting data requires the dllimport decoration (when used by other code)
to tell MSVC how to correctly locate and import the symbol from the DLL;
this is technically not needed for functions, but is mandatory for data.

So for instance, when you declare the following somewhere in liboctave

extern OCTAVE_API int x;

it expands to

extern __declspec(dllexport) int x;

when liboctave is compiled. And it expands to

extern __declspec(dllimport) int x;

when used outside liboctave compilation. This is controlled by the OCTAVE_DLL
flag. As this is DLL-specific, you need such a mechanism for each DLL, that's
why you have CRUFT_API, OCTAVE_API and OCTINTERP_API.

So the main line is: if you want a symbol to be part of the API,
decorate it with
CRUFT_API, OCTAVE_API or OCTINTERP_API when that symbol is in
libcruft, liboctave or liboctinterp respectively.

Hope this makes things clearer.

Michael.


reply via email to

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