English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. C/C++

 
 
Thread Tools
Old 27 February 2022, 16:06   #1
tygre
Returning fan!
 
tygre's Avatar
 
Join Date: Jan 2011
Location: Montréal, QC, Canada
Posts: 1,434
VBCC & AmigaOS 3.1 NDK?

Hi all!

I'm mimicking this other thread about AmigaOS 3.2 because I think that I've got the same problem but in the other "direction"... and also because it proposes a solution that I don't know how to apply

So, I was happily compiling with the VBCC and the NDK 3.9 when I wanted to compile against the NDK 3.1 (yes, 3.1).

Naively, I thought that I could "just" point to the includes in the NDK 3.1 but that leads to too many warnings. Here is an example:

Code:
>LONG __Write(__reg("a6") void *, __reg("d1") BPTR file, __reg("d2") CONST APTR 
warning 57 in line 17 of "inline/dos_protos.h": , expected
        included from file "vincludeos3:proto/dos.h":22
        included from file "blacklists.c":46
It seems that the protos in VBCC works well with NDK 3.9 (compile, no warnings) but not NDK 3.1 (many warnings). Is that the problem? How could I obtain/generate protos that works with the NDK 3.1?

Cheers!

PS. Command lines:
  • Compiles, no warnings with NDK 3.9:
    Code:
    vbcc:bin/vc -lmieee -cpp-comments -c99 -Idevkits:sdk/classic/MUI/Developer/C/Include/
     -Idevkits:sdk/classic/NDK_39/include/include_h/ -Idevkits:sdk/classic/Roadshow/netinclude/
     -IDevKits:sdk/classic/XAD/Include/C/ -IDevKits:compilers/vbcc/0.9g/posixlib/include/ -IWorkspace:AmiModRadio/
     -Lvbcc:targets/m68k-amigaos/lib/ -lamiga -g -DFORTIFY  -c blacklists.c -o o/vbcc-classic/debug/blacklists.o
  • Many warnings with NDK 3.1:
    Code:
    vbcc:bin/vc -lmieee -cpp-comments -c99 -Idevkits:sdk/classic/MUI/Developer/C/Include/
     -Idevkits:sdk/classic/NDK_31/Includes_Libs/include_h/ -Idevkits:sdk/classic/Roadshow/netinclude/
     -IDevKits:sdk/classic/XAD/Include/C/ -IDevKits:compilers/vbcc/0.9g/posixlib/include/ -IWorkspace:AmiModRadio/
     -Lvbcc:targets/m68k-amigaos/lib/ -lamiga -g -DFORTIFY  -c blacklists.c -o o/vbcc-classic/debug/blacklists.o
tygre is offline  
Old 27 February 2022, 17:58   #2
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
These dos.library inlines were generated with NDK3.9 clib headers, which declares the second argument of Write() as
CONST APTR
. Problem is that NDK3.1 doesn't know about
CONST
. It was introduced with NDK3.9.

You may work around it by adding a
Code:
#define CONST const
before including any of these headers, but the best approach would be to regenerate all proto and inline headers with fd2pragma, using the clib headers from NDK 3.1.

EDIT: Or better "#define CONST" (without const), to match the 3.1 prototypes.

Last edited by phx; 27 February 2022 at 17:59. Reason: #define CONST
phx is offline  
Old 27 February 2022, 19:28   #3
tygre
Returning fan!
 
tygre's Avatar
 
Join Date: Jan 2011
Location: Montréal, QC, Canada
Posts: 1,434
Hi PHX and thanks for your help always

I'm going to try to generate the NDK 3.1-compliant protos and inlines using fd2pragma like you explained me for RoadShow and also here, thanks a lot

Cheers!

PS. Could you explain me why these protos and inlines are necessary and how they are used by the compiler?
tygre is offline  
Old 27 February 2022, 19:45   #4
patrik
Registered User
 
patrik's Avatar
 
Join Date: Jan 2005
Location: Umeå
Age: 43
Posts: 922
Is there a specific need to use the 3.1 NDK? A more recent NDK just gives you the possibility to use functions/libraries added after 3.1, but you still choose which functions/libraries you use yourself.
patrik is offline  
Old 27 February 2022, 20:07   #5
tygre
Returning fan!
 
tygre's Avatar
 
Join Date: Jan 2011
Location: Montréal, QC, Canada
Posts: 1,434
Hi Patrick!

Yes, that's exactly the reason why I'd like to compile for "strictly" 3.1: I'm not too clear (my bad!) on which functions/libraries are in 3.1, only 3.9, and now only 3.2

So I'd like to compile for 3.1 and add what I need as I need them, like MUI, RoadShow, XAD and now ClassAct...

Cheers!
tygre is offline  
Old 27 February 2022, 20:57   #6
Minuous
Coder/webmaster/gamer
 
Minuous's Avatar
 
Join Date: Oct 2001
Location: Canberra/Australia
Posts: 2,630
Best to use a more recent NDK. Anything new will be clearly marked as "(V45)", etc.
Minuous is offline  
Old 27 February 2022, 22:14   #7
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
Quote:
Originally Posted by tygre View Post
PS. Could you explain me why these protos and inlines are necessary and how they are used by the compiler?
They are not necessary. But by including
<proto/xyz.h>
you make sure that your compiler uses the most efficient way to call library functions (inlines for vbcc and gcc, pragmas for SAS/C, Aztec-C, DiceC).
An alternative, which always works, is to include
<clib/xyz_protos.h>
instead. Then you will have to link a stub routine from amiga.lib to call a library function. But you have less problems with modified argument types between NDK releases.
phx is offline  
Old 27 February 2022, 23:23   #8
tygre
Returning fan!
 
tygre's Avatar
 
Join Date: Jan 2011
Location: Montréal, QC, Canada
Posts: 1,434
Thanks a lot PHX

Also, I managed the generate the inlines and recompile successfully AmiModRadio with them!
tygre is offline  
Old 08 March 2022, 23:44   #9
alancfrancis
Registered User
 
alancfrancis's Avatar
 
Join Date: Jun 2020
Location: Scotland
Posts: 146
Hey this is tangential to your problem but NDK3.2R4 (available today on the Hyperion website) includes a great explainer about all the proto/pragma/inline stuff and why it’s all so compiler specific.
alancfrancis is offline  
Old 09 March 2022, 00:03   #10
tygre
Returning fan!
 
tygre's Avatar
 
Join Date: Jan 2011
Location: Montréal, QC, Canada
Posts: 1,434
Hi Alancfrancis!

Thanks a lot!

I just downloaded it and will read "InterfaceHeaderFiles", by Olaf Barthel!, later

Cheers!

Last edited by tygre; 07 April 2022 at 04:22. Reason: Missing s
tygre is offline  
Old 09 March 2022, 00:18   #11
alancfrancis
Registered User
 
alancfrancis's Avatar
 
Join Date: Jun 2020
Location: Scotland
Posts: 146
@tygre I really enjoyed it. Explained so much that I hadn’t really understood before.
alancfrancis is offline  
Old 09 March 2022, 02:41   #12
arcanist
Registered User
 
Join Date: Dec 2017
Location: Austin, TX
Age: 41
Posts: 405
Quote:
Originally Posted by alancfrancis View Post
Hey this is tangential to your problem but NDK3.2R4 (available today on the Hyperion website) includes a great explainer about all the proto/pragma/inline stuff and why it’s all so compiler specific.
That's a really good read. I never quite got my head around all the different implementations.

I ran into that preprocessor-token-in-tagcall issue with GCC + MUI. Stumbled upon the NO_INLINE_STDARG solution but didn't know why it worked until now.
arcanist is offline  
Old 13 March 2022, 00:27   #13
tygre
Returning fan!
 
tygre's Avatar
 
Join Date: Jan 2011
Location: Montréal, QC, Canada
Posts: 1,434
Hi Alancfrancis and all!

Very very interesting indeed, thanks

And all this to have parameter values in CPU registers rather than on the stack!

Now, am I right to think that I should avoid including anything in clib, pragmas, pragma, and inline and, rather, include only things in proto? Especially with the NDK 3.2 R3 that supports VBCC now

But then, I wonder what to do about clib/alib_protos.h then? There doesn't see to exist any include file in proto that declare, for example, CreatePort, NewList...

Cheers!

Last edited by tygre; 13 March 2022 at 06:35.
tygre is offline  
Old 13 March 2022, 14:08   #14
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
Quote:
Originally Posted by tygre View Post
Now, am I right to think that I should avoid including anything in clib, pragmas, pragma, and inline and, rather, include only things in proto?
Yes.

Quote:
But then, I wonder what to do about clib/alib_protos.h then? There doesn't see to exist any include file in proto that declare, for example, CreatePort, NewList...
Since NDK3.2 there is also
proto/alib.h
. But for compatibility with older NDKs you may want to stick to
clib/alib_protos.h
.
phx is offline  
Old 13 March 2022, 15:43   #15
tygre
Returning fan!
 
tygre's Avatar
 
Join Date: Jan 2011
Location: Montréal, QC, Canada
Posts: 1,434
Quote:
Originally Posted by phx View Post
Yes.


Since NDK3.2 there is also
proto/alib.h
. But for compatibility with older NDKs you may want to stick to
clib/alib_protos.h
.
Thanks again PHX!
tygre is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
AmigaOS 3.2 NDK released bubbob42 News 15 21 October 2023 18:56
VBCC & AmigaOS 3.2 NDK? Warty Coders. C/C++ 20 18 June 2021 08:41
AmigaOS & lha Ulysses13 New to Emulation or Amiga scene 4 04 June 2021 20:58
VBCC/NDK/Make AmiTCP dependency? Sim085 support.Apps 2 22 February 2020 22:32
VBCC & guru meditation majikeyric Coders. C/C++ 11 10 October 2018 08:37

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 17:06.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.09077 seconds with 15 queries