gm2
[Top][All Lists]
Advanced

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

Re: Portable bitwise operations library (was Re: Portability Considerati


From: Gaius Mulley
Subject: Re: Portable bitwise operations library (was Re: Portability Considerations)
Date: Sat, 23 Mar 2024 11:32:44 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)

Benjamin Kowarsch <trijezdci@gmail.com> writes:

> Actually, I use "imp" for the subdirs that contain the .mod files, not "mod".
>
> On Sat, 23 Mar 2024 at 08:08, Benjamin Kowarsch <trijezdci@gmail.com> wrote:
>
>  On Sat, 23 Mar 2024 at 07:40, Gaius Mulley wrote:
>
>  john o goyo writes:
>
>  > [~/opt/Alice]=> gcc-git -c -fiso -I. CardBitOps.mod
>  > <built-in>: error: the file containing the definition module cannot be 
> found
>  >
>  > Gaius, any insight here?
>
>  yes gm2 is trying to create a definition module symbol and cannot find
>  the CardBitOps.def file, and uses the builtin location (previously it
>  would give a misleading error message location in the implementation
>  module source file).  Perhaps the error message could be improved
>  though?
>
>   I also separate .def and .mod files in my projects.
>
>  However, I put the interfaces in the top levels of each source tree 
> directory and the implementations in their respective imp subdirectories
>
>  /src
>     /... any library subdirs ...
>     /mod
>        foo.mod
>        bar.mod
>     foo.def
>     bar.def
>
>  The reason why I believe that the interfaces belong in to the top level is 
> that source code should always be presented for the ease of use and
>  convenience of the reader, not for the convenience of the author. For the 
> user/reader, the most important part of a library are the interfaces. They may
>  never even look at the implementations, but they will need the interfaces.
>
>  Therefore, if the two are separated to reduce clutter which also makes the 
> library easier to use for readers, then the interfaces should go in to the top
>  level, and the implementations into a subdirectory.
>
>  Perhaps, GM2 could accommodate this kind of source tree structure with a 
> simple compiler switch.

Hi Benjamin,

  $ gm2 -g -I/src -I/src/imp usersource.mod

should work with the above.  Easy/lazy linking during development can be
performed by:

  $ gm2 -g -I/src -I/src/imp usersource.mod -fm2-whole-program

After development and for deployment third party libraries can be
installed alongside the gm2 libs, see section: Why use GNU Modula-2.
(Also note the -flibs= option).

"""
The gm2 driver allows third party libraries to be installed alongside
gm2 libraries.  For example if the user specifies library @code{foo}
using @code{-flibs=foo} the driver will check the standard GCC install
directory for a sub directory @code{foo} containing the library
contents.  The library module search path is altered accordingly
for compile and link.
"""

The -fm2-whole-program can be very useful during development as it
gives the ability to compile without optimisation and full debugging
on all code (including libraries):

  $ gm2 -g -I/src -I/src/imp usersource.mod -fm2-whole-program -O0 -fm2-g

forcing a nop (minimum) at each m2 statement
  
regards,
Gaius



reply via email to

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