[gccsdk] Problem with using GCC/CMunge for modules with C++

Terje Slettebø tslettebo at broadpark.no
Sat Sep 10 15:25:25 PDT 2011

Hi Lee.

Odd, I did test using "module-is-c-plus-plus:" at some point, but dropped it 
again when it didn't work (and it appeared to only be relevant for 
Norcroft), but that was probably because something else didn't work at the 
time. Once everything worked, it never occurred to me to test it again...

I've confirmed that it works for me, too. Thanks, great that you found the 
solution. :)

By the way, although not GCC-specific, just module-specific, maybe somebody 
here have some idea about what I post here, too: 



----- Original Message ----- 
From: "Lee Noar" <leenoar at sky.com>
To: <gcc at gccsdk.riscos.info>
Sent: Saturday, September 10, 2011 7:55 PM
Subject: Re: [gccsdk] Problem with using GCC/CMunge for modules with C++

On 03/09/11 14:30, Terje Slettebø wrote:
> Hi again.
>> From: "John Tytgat" <John.Tytgat at aaug.net>
>>> On 28/08/11 17:18, Terje Slettebø wrote:
>>>> I've tried this too, and, yes, it works: I can use the vector
>>>> in those functions, now, thanks! :)
>>>> I also tried this (instead of the <stdio.h> header):
>>>> #include <iostream>
>>>> std::cout << "Test"; // Inside gccmodule_init()
>>>> but that crashed ("Abort on data transfer at &20AB2ACC9"). The
>>>> original puts() works, though. I wonder why. Maybe there's a
>>>> difference between how GCC handles C/C++ I/O.
>>> Hmm, this one may take more time. Unfortunately, I probably wont
>>>  be able to fix this before I go on holiday, but I will take a
>>> look when I get back.
>> FYI, I never tried to use STL for C++ coded modules so I'm not
>> surprised there are some interesting things to be fixed there ;-)
> <snip>
> Thanks for the feedback. :) Like I said in the followup mail, it
> appears that other parts of the standard C++ library, like
> std::vector, works, and working with modules, iostream would mostly
> be useful for debugging, anyway, and then C functions may be used
> instead.
> Regards,
> Terje

Looks like this may not be so difficult after all. Adding the
module-is-c-plus-plus keyword to your cmhg file has the effect of
ensuring that constructors for static global objects like cerr, cin and
cout are called.


More information about the gcc mailing list