gm2
[Top][All Lists]
Advanced

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

Re: [Gm2] version of compile time library


From: Martin Kalbfuß
Subject: Re: [Gm2] version of compile time library
Date: Thu, 17 Dec 2009 04:06:39 +0100

Hi,

If I see this correct this would return the version of the linked
library. But if you use dynamic linking the version at compilation and
execution could be different. A define in a header is included in the
program at compile time. So it represents always the compile time
version of the lib. A function or constant should return the linked
version. Or not? But Modula-2 cannot export defines and macros. So I get
always the linked version.

Am Donnerstag, den 17.12.2009, 01:50 +0000 schrieb Gaius Mulley:
> Martin Kalbfuß <address@hidden> writes:
> 
> > Hi,
> >
> > SDL has two ways of getting the library version. A function which is
> > returning the version of the linked library. And some defines in a
> > header repesenting the compile time version. Modula-2 has definition
> > modules. Not headers. So I'm not sure how to to something like this?
> > I tried to include the defines in the definition module of the library.
> > But the program importing the module doesn't see them.
> > What about __INLINE__? Could this help here?
> >
> > Thanks,
> 
> Hi Martin,
> 
> 2 ways to achieve this:
> 
> (i)  either the implementation module could
>   #include <header.h>
> 
> CONST
>    m2_major = CPP_VERSION_MAJOR ;
>    m2_minor = CPP_VERSION_MINOR ;   (* etc *)
> 
> and set some record constructor which is initialised to these
> values.  You need to compile the implementation module using -fcpp.
> 
> (ii)  or possibly write a C wrapper implementation module, write a
>       M2 definition module for C and export the function which returns
>       a C constructor.
> 
> there are probably other ways but these are the two I would consider first,
> 
> regards,
> Gaius






reply via email to

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