21 August 2022, 10:31 | #1 |
Bruno
Join Date: Aug 2020
Location: Nantes / France
Posts: 111
|
VBCC and SysBase in aos68km target
There is something that I do not understand and that seems weird regarding the SysBase declaration.
I am using :
• Compiling the code at the end of my post which use SysBase with those parameter works fine : VC +aos68km -v Librairies.c -o Librairies-inline -I../lib/NDK3.2R4/Include_H • However, when disabling inline calls, strangely SysBase is undeclared: VC +aos68km -v Librairies.c -lamiga -o Librairies-no-inline-err -D_NO_INLINE -I../lib/NDK3.2R4/Include_H ->VPrintf("SysBase->SoftVer=%u\n", & (SysBase->SoftVer)); error 82 in line 12 of "Librairies.c": unknown identifier <SysBase> Defining _NO_INLINEprevents SysBase to be set up. It seems that proto\exec.h of AmigaOS NDK does not define SysBase when _NO_INLINEis defined. • It builds fine if I explicitly list VBCC target headers file before AmigaOS NDK 3.2 headers when calling VC : VC +aos68km -v Librairies.c -lamiga -o Librairies-no-inline-ok -D_NO_INLINE -Ibin/targets/m68k-amigaos/include -I../lib/NDK3.2R4/Include_H Is there another better way to force VC frontend to use VBCC target include file before NDK include files when calling vbccm68k ? I mean from the command line. (without altering VC config file). Librairies.c : Code:
#include <proto/exec.h> #include <proto/dos.h> struct DosLibrary *DOSBase; int main() { DOSBase = (struct DosLibrary *) OpenLibrary("dos.library", 0); if (DOSBase) { VPrintf("SysBase->SoftVer=%u\n", & (SysBase->SoftVer)); CloseLibrary((struct Library *)DOSBase); } return 0; } Last edited by Jami; 21 August 2022 at 18:19. |
22 August 2022, 00:27 | #2 |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,316
|
What you observe here is that <proto/exec.h> declares the execbase library entries such that SysBase is taken from address 4, and for that reason does not need SysBase as external symbol. If it is not declared, no harm is done for calling exec functions - except that they are slower than necessary because the code has now to get SysBase from chip RAM (or even worse, has to emulate the access).
|
22 August 2022, 17:07 | #3 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,546
|
Hmm... no, I don't think this is what Jami means. You can see that with all NDK3.2 proto-headers. Not only for
proto/exec.h. For example proto/graphics.h: Code:
#ifdef _NO_INLINE #include <clib/graphics_protos.h> #else /****************************************************************************/ #ifndef __NOLIBBASE__ #ifndef GRAPHICS_GFXBASE_H #include <graphics/gfxbase.h> #endif /* GRAPHICS_GFXBASE_H */ extern struct GfxBase * GfxBase; #endif /* __NOLIBBASE__ */ _NO_INLINE, which is different to the proto headers coming with vbcc. I wouldn't call that a big problem, but maybe I should have insisted in vbcc-compatibility when talking with Olaf Barthel about the new NDK. NDK3.9 doesn't have that problem, but it also doesn't support _NO_INLINE. Usually the problem shouldn't occur, because you should set up your vbcc config file for aos68k (and aos68km) in a way that the vbcc-headers always have priority over the NDK-headers (the Installer for AmigaOS does that automatically). To be on the safe side, and also to be compatible with other compilers using NDK3.2, define __NOLIBBASE__, and always declare the required library bases yourself. |
22 August 2022, 19:35 | #4 |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,316
|
All I'm saying is that there are two pragma headers for exec, one taking a6 from location 4 (AbsExecBase), and one from SysBase. If you include the firs one (which is the default), then declaring SysBase is not required, which would explain that no obvious problem is detected when calling functions in exec (and the call being a bit slow), but if the second one is used (sorry, forgot the file name), then a missing definition of SysBase will be detected by the linker.
|
24 August 2022, 18:42 | #5 | |
Bruno
Join Date: Aug 2020
Location: Nantes / France
Posts: 111
|
@Thomas : Thank for your answer. Actually the problem I had was occuring at compiling stage.
Quote:
Thank you phx for this tip |
|
24 August 2022, 23:24 | #6 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,546
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Target Renegade | Havie | project.Amiga Game Factory | 183 | 26 November 2022 08:54 |
Segmentation fault VBCC on Debian target warpos | Hedeon | Coders. C/C++ | 4 | 01 May 2021 21:20 |
Improved input target | Lucas | request.UAE Wishlist | 2 | 13 September 2013 14:42 |
Alien Target | Shoonay | Games images which need to be WHDified | 14 | 30 January 2012 16:58 |
Monkey Amiga Target 0.25 | bruZard | News | 0 | 13 December 2011 21:20 |
|
|