Welcome, Guest. Please login or register.

Author Topic: Karlos' weekly GNU/ANSI C++ on amiga bash :-)  (Read 2779 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline KarlosTopic starter

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show only replies by Karlos
Karlos' weekly GNU/ANSI C++ on amiga bash :-)
« on: April 03, 2004, 10:19:00 PM »
Hi,

It's Saturday, so that must mean its time for another stupid question regarding amigaos + GCC/C++ :-D

It seems that any code using amiga os shared libraries from GCC/C++ mode refuses to link unless there is a stub .lib for that library.

This is totally irritating - am I doing something wrong here? Surely there should be some other mechanism for handling OS calls or do we alwys need a stub?

The increase in code size alone is starting to annoy me without having to make stubs for every shared library not covered by amiga.lib :-x

Someone please tell me there is a #pragma or some other method for this!

-edit-

I dunno. You go to the effort of at least trying to make your code more standards compliant by moving to gcc and it just wants to throw endless obstacles your way :-(

No wonder most amiga stuff is still written in C - it's the only way to stay sane :lol:
int p; // A
 

Offline GadgetMaster

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2177
    • Show only replies by GadgetMaster
Re: Help needed using amigaos shared libraries in GCC ANSI C++ mode
« Reply #1 on: April 07, 2004, 11:27:33 PM »
BUMP

Did you find the solutioin yet?

I'm surprised nobody has answered yet.
 

Offline PiR

  • Full Member
  • ***
  • Join Date: Apr 2003
  • Posts: 148
    • Show only replies by PiR
Re: Help needed using amigaos shared libraries in GCC ANSI C++ mode
« Reply #2 on: April 08, 2004, 07:07:50 PM »
Quote

GadgetMaster wrote:
BUMP

Did you find the solutioin yet?

I'm surprised nobody has answered yet.


And what I am most surprized at is:
WHY, THE HELL GNU C++ DOESN'T RECOGNIZE ITS OWN PRAGMAS FROM GNU C???

At least that's what I understood from few Karlos' threads.

Hmmm... thinking of it - mayby thats because of C++ mangling fascilities?

That makes me completly :insane:.
 

Offline itix

  • Hero Member
  • *****
  • Join Date: Oct 2002
  • Posts: 2380
    • Show only replies by itix
Re: Help needed using amigaos shared libraries in GCC ANSI C++ mode
« Reply #3 on: April 08, 2004, 08:36:42 PM »
Hmm?? In MorphOS I'm using GCC and C++ code compiles just fine without stubs. However certain inline stuff is not working but in general I can compile without stubs...
My Amigas: A500, Mac Mini and PowerBook
 

Offline KarlosTopic starter

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show only replies by Karlos
Re: Help needed using amigaos shared libraries in GCC ANSI C++ mode
« Reply #4 on: April 08, 2004, 11:36:00 PM »
@itix

A few *issues* Im having in ANSI C++ mode

1) Register specific parameters to a function (as allowed in ANSI C mode), using __asm("regname") refuse to be accepted. That's one avenue for library function calls gone.

2) #pragmas for library calls (and tag calls) aren't recognised either.

3) Final code size has absolutely *ballooned* compared to stormc v3. My old image warping demo used to compile to 56Kb, the gcc version compiles to 130Kb. Perversely, the object sizes for my code are similar, so the problem must be code added during linking.

So far, it seems I have to use stub libraries, resulting in a stack based call to a function that has to do call the OS in turn. Not the most efficient thing.

@PiR

I know. Mental, isnt it? I found that perfectly acceptable ANSI C headers, that contain register specific parameters in function prototypes simply *refuse* to be accepted in C++ mode, even with the extern "C" decleration.

A friend reported the same issue with gcc under linux x86 too.
int p; // A
 

Offline KarlosTopic starter

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show only replies by Karlos
Re: Help needed using amigaos shared libraries in GCC ANSI C++ mode
« Reply #5 on: April 08, 2004, 11:43:20 PM »
Changed title to something more "on topic" :-)

@GadgetMaster

Still scratching my head for a non stub library way here since you last popped round, but I've resigned to it for now. If a magic third option appears I'll rebuild the entire lot then :-)
int p; // A