Discussion:
How to "switch" between libraries using GNU Modula-2
(too old to reply)
s***@gmail.com
2013-10-05 16:10:35 UTC
Permalink
Hello,

I'm new to Modula-2 (I switched to Modula-2 from C++, I only had basic C++ knowledge, still quite new to programming but understand the basics and OOP).

I just compiled Modula-2 on my Fedora 19 x86_64 KDE computer. And I'm wondering if it's possible to "switch" between different standard libraries. As there seem to be different libs. ISO and PIM. It seems that GNU Modula-2 uses the PIM libraries by default (as I could IMPORT and use MODULES of which I found .def's and .mod's in the PIM directory, but I couldn't use TextIO from the ISO libraries). Is there a way to switch to using the ISO libraries? I'm not sure which of the 2 libraries is "better" or "recommended", but I'd just like to try it out myself ;)

Kind Regards,

Superpelican
Christoph Schlegel
2013-10-05 21:21:25 UTC
Permalink
Post by s***@gmail.com
Hello,
I'm new to Modula-2 (I switched to Modula-2 from C++, I only had basic C++ knowledge, still quite new to programming but understand the basics and OOP).
I just compiled Modula-2 on my Fedora 19 x86_64 KDE computer. And I'm wondering if it's possible to "switch" between different standard libraries. As there seem to be different libs. ISO and PIM. It seems that GNU Modula-2 uses the PIM libraries by default (as I could IMPORT and use MODULES of which I found .def's and .mod's in the PIM directory, but I couldn't use TextIO from the ISO libraries). Is there a way to switch to using the ISO libraries? I'm not sure which of the 2 libraries is "better" or "recommended", but I'd just like to try it out myself ;)
Kind Regards,
Superpelican
Hi,

the compiler options are listed and described here:
http://www.nongnu.org/gm2/compiler_options.html

the option you are looking for is

-flibs=
modifies the default library search path. The libraries supplied are: pim, iso, min, logitech, pim-coroutine and ulm. These map onto the Programming in Modula-2 base libraries, ISO standard libraries, minimal library support, Logitech compatible library and University of Ulm library. Multiple libraries might be specified and are comma separated with precidence going to the first in the list. It is not necessary to use -flibs=pim or -flibs=iso if you also specify -fpim, -fpim2, -fpim3, -fpim4 or -fiso.

You may want to subscribe to the GNU Modula-2 mailing list to ask questions specific to the compiler there. More info is here:

https://lists.nongnu.org/mailman/listinfo/gm2/

Have fun!

Christoph
Superpelican Dev
2013-10-06 14:46:04 UTC
Permalink
Post by Christoph Schlegel
Post by s***@gmail.com
Hello,
I'm new to Modula-2 (I switched to Modula-2 from C++, I only had basic C++ knowledge, still quite new to programming but understand the basics and OOP).
I just compiled Modula-2 on my Fedora 19 x86_64 KDE computer. And I'm wondering if it's possible to "switch" between different standard libraries. As there seem to be different libs. ISO and PIM. It seems that GNU Modula-2 uses the PIM libraries by default (as I could IMPORT and use MODULES of which I found .def's and .mod's in the PIM directory, but I couldn't use TextIO from the ISO libraries). Is there a way to switch to using the ISO libraries? I'm not sure which of the 2 libraries is "better" or "recommended", but I'd just like to try it out myself ;)
Kind Regards,
Superpelican
Hi,
http://www.nongnu.org/gm2/compiler_options.html
the option you are looking for is
-flibs=
modifies the default library search path. The libraries supplied are: pim, iso, min, logitech, pim-coroutine and ulm. These map onto the Programming in Modula-2 base libraries, ISO standard libraries, minimal library support, Logitech compatible library and University of Ulm library. Multiple libraries might be specified and are comma separated with precidence going to the first in the list. It is not necessary to use -flibs=pim or -flibs=iso if you also specify -fpim, -fpim2, -fpim3, -fpim4 or -fiso.
https://lists.nongnu.org/mailman/listinfo/gm2/
Have fun!
Christoph
Thanks a lot Christoph,

I wasn't aware of the existence of the compiler options page, IMHO the GNU Modula-2 website isn't really user friendly. I find it to be quite difficult to find information on the website. :(

I also didn't know the mailing list existed, I'll definitely subscribe to it. :)

I was very happy when I found this newsgroup and saw that you responded so quickly. As I to be honest was getting a little bit worried about the amount of information and ways to ask questions available for Modula-2. It's really a shame that it's not quite popular. It deserves a lot better ;)

I do have one question left: yesterday I was trying to find out what the maximum range is of cardinal (on a 64 bit platform) and longcard. I came across the MAX function. But to my surprise cardinal and longcard both have the same range (on my machine)! Is this normal? And how can I store larger numbers than approx. 4,2 billion? Other programming languages (including Free Pascal) seem to be capable of storing *much* bigger numbers (http://wiki.freepascal.org/Variables_and_Data_Types). Also the longword type on Free Pascal (which has (approx.) the same range as the longcard on GNU Modula-2) uses only 4 bytes compared to 8 bytes for the longcard.

Also when I declared a subrange variable with the range 0..999999999 (1 billion - 1), the type still used 8 bytes! I thought the compiler was clever enough to use less memory for programmer defined subranges/programmer defined subrange types?

Kind Regards,

Superpelican
a***@drrob1.com
2013-10-06 19:20:33 UTC
Permalink
On Sun, 6 Oct 2013 07:46:04 -0700 (PDT), Superpelican Dev
Post by Superpelican Dev
Post by Christoph Schlegel
Post by s***@gmail.com
Hello,
I'm new to Modula-2 (I switched to Modula-2 from C++, I only had basic C++ knowledge, still quite new to programming but understand the basics and OOP).
I just compiled Modula-2 on my Fedora 19 x86_64 KDE computer. And I'm wondering if it's possible to "switch" between different standard libraries. As there seem to be different libs. ISO and PIM. It seems that GNU Modula-2 uses the PIM libraries by default (as I could IMPORT and use MODULES of which I found .def's and .mod's in the PIM directory, but I couldn't use TextIO from the ISO libraries). Is there a way to switch to using the ISO libraries? I'm not sure which of the 2 libraries is "better" or "recommended", but I'd just like to try it out myself ;)
Kind Regards,
Superpelican
Hi,
http://www.nongnu.org/gm2/compiler_options.html
the option you are looking for is
-flibs=
modifies the default library search path. The libraries supplied are: pim, iso, min, logitech, pim-coroutine and ulm. These map onto the Programming in Modula-2 base libraries, ISO standard libraries, minimal library support, Logitech compatible library and University of Ulm library. Multiple libraries might be specified and are comma separated with precidence going to the first in the list. It is not necessary to use -flibs=pim or -flibs=iso if you also specify -fpim, -fpim2, -fpim3, -fpim4 or -fiso.
https://lists.nongnu.org/mailman/listinfo/gm2/
Have fun!
Christoph
Thanks a lot Christoph,
I wasn't aware of the existence of the compiler options page, IMHO the GNU Modula-2 website isn't really user friendly. I find it to be quite difficult to find information on the website. :(
I also didn't know the mailing list existed, I'll definitely subscribe to it. :)
I was very happy when I found this newsgroup and saw that you responded so quickly. As I to be honest was getting a little bit worried about the amount of information and ways to ask questions available for Modula-2. It's really a shame that it's not quite popular. It deserves a lot better ;)
I do have one question left: yesterday I was trying to find out what the maximum range is of cardinal (on a 64 bit platform) and longcard. I came across the MAX function. But to my surprise cardinal and longcard both have the same range (on my machine)! Is this normal? And how can I store larger numbers than approx. 4,2 billion? Other programming languages (including Free Pascal) seem to be capable of storing *much* bigger numbers (http://wiki.freepascal.org/Variables_and_Data_Types). Also the longword type on Free Pascal (which has (approx.) the same range as the longcard on GNU Modula-2) uses only 4 bytes compared to 8 bytes for the longcard.
Also when I declared a subrange variable with the range 0..999999999 (1 billion - 1), the type still used 8 bytes! I thought the compiler was clever enough to use less memory for programmer defined subranges/programmer defined subrange types?
Kind Regards,
Superpelican
I also find the gnu modula-2 web site not user friendly.

And I'm not having an easy time getting help, just like you
m***@gmail.com
2013-10-08 11:16:28 UTC
Permalink
Post by Superpelican Dev
Post by Christoph Schlegel
Post by s***@gmail.com
Hello,
I'm new to Modula-2 (I switched to Modula-2 from C++, I only had basic C++ knowledge, still quite new to programming but understand the basics and OOP).
I just compiled Modula-2 on my Fedora 19 x86_64 KDE computer. And I'm wondering if it's possible to "switch" between different standard libraries. As there seem to be different libs. ISO and PIM. It seems that GNU Modula-2 uses the PIM libraries by default (as I could IMPORT and use MODULES of which I found .def's and .mod's in the PIM directory, but I couldn't use TextIO from the ISO libraries). Is there a way to switch to using the ISO libraries? I'm not sure which of the 2 libraries is "better" or "recommended", but I'd just like to try it out myself ;)
Kind Regards,
Superpelican
Hi,
http://www.nongnu.org/gm2/compiler_options.html
the option you are looking for is
-flibs=
modifies the default library search path. The libraries supplied are: pim, iso, min, logitech, pim-coroutine and ulm. These map onto the Programming in Modula-2 base libraries, ISO standard libraries, minimal library support, Logitech compatible library and University of Ulm library. Multiple libraries might be specified and are comma separated with precidence going to the first in the list. It is not necessary to use -flibs=pim or -flibs=iso if you also specify -fpim, -fpim2, -fpim3, -fpim4 or -fiso.
https://lists.nongnu.org/mailman/listinfo/gm2/
Have fun!
Christoph
Thanks a lot Christoph,
I wasn't aware of the existence of the compiler options page, IMHO the GNU Modula-2 website isn't really user friendly. I find it to be quite difficult to find information on the website. :(
I also didn't know the mailing list existed, I'll definitely subscribe to it. :)
I was very happy when I found this newsgroup and saw that you responded so quickly. As I to be honest was getting a little bit worried about the amount of information and ways to ask questions available for Modula-2. It's really a shame that it's not quite popular. It deserves a lot better ;)
I do have one question left: yesterday I was trying to find out what the maximum range is of cardinal (on a 64 bit platform) and longcard. I came across the MAX function. But to my surprise cardinal and longcard both have the same range (on my machine)! Is this normal? And how can I store larger numbers than approx. 4,2 billion? Other programming languages (including Free Pascal) seem to be capable of storing *much* bigger numbers (http://wiki.freepascal.org/Variables_and_Data_Types). Also the longword type on Free Pascal (which has (approx.) the same range as the longcard on GNU Modula-2) uses only 4 bytes compared to 8 bytes for the longcard.
Also when I declared a subrange variable with the range 0..999999999 (1 billion - 1), the type still used 8 bytes! I thought the compiler was clever enough to use less memory for programmer defined subranges/programmer defined subrange types?
interesting, thanks for the bug report - I will investigate.
The data types LONGCARD and CARDINAL (and others should map onto their
C counterparts as defined here):

http://www.nongnu.org/gm2/elementary_data_types.html

slightly off topic, you should be able pack data in records via
this mechanism.

http://www.nongnu.org/gm2/packed.html

regards,
Gaius
Post by Superpelican Dev
Kind Regards,
Superpelican
Loading...