error: 'struct Library' has no member named 'LibNode'.
I am sure it should be something easy like some casting or so, but just stuck with it a bit. I even do search on all LibNode entryes in whole SDK, and include all includes where find out this: no luck. As well as trying to case IntuitionBase as (struct Library *): no luck as well.
Edited by kas1e on 2013/3/22 6:44:43 Edited by kas1e on 2013/3/22 6:48:11 Edited by kas1e on 2013/3/22 6:50:01 Edited by kas1e on 2013/3/22 12:06:54
IntuitionBase * as implicitly declared in that minimal program is a struct Library *, clearly a struct Library * has no member LibBase as that is the lib base.....
In AmigaOS 4.x the global library base variables are by default all defined as pointers to struct Library rather than some base variables using more specific types like struct ExecBase, IntuitionBase, ...
If you want the old behavior for compatibility with older code you just need to add -D__USE_BASETYPE__ to the compiler flags.
But for os4 build i comment them out, as gcc scream about:
Quote:
data.c:32: error: conflicting types for 'IntuitionBase' /usr/local/amiga/ppc-amigaos/SDK/include/include_h/proto/intuition.h:40: note: previous declaration of 'IntuitionBase' was here data.c:33: error: conflicting types for 'GfxBase' /usr/local/amiga/ppc-amigaos/SDK/include/include_h/proto/graphics.h:57: note: previous declaration of 'GfxBase' was here
And so i need to keep original code as much as possible untouched, just to make it compiles on os4 with use_inline. I can of course add casts + ifdefs, but better to keep original code at first native compile as much as possible.
@salas00 Thanks ! -D__USE_BASETYPE__ did the trick
@all I also meet in code with some obsolete on os4 intuition defines such as:
STRINGCENTER STRINGRIGHT STRINGLEFT
They all in the intuition/iobsolete.h , but including such a file didn't help. I also tryed to set #define INTUITION_PRE_V36_NAMES , as well as use-D__INTUITION_PRE_V36_NAMES__ : no luck. Is there another switch or the only way is to copy+paste defines to code ?
They all in the intuition/iobsolete.h , but including such a file didn't help. I also tryed to set #define INTUITION_PRE_V36_NAMES , as well as use-D__INTUITION_PRE_V36_NAMES__ : no luck. Is there another switch or the only way is to copy+paste defines to code ?
The symbol must be named "INTUITION_PRE_V36_NAMES" and not "__INTUITION_PRE_V36_NAMES__". And you must define it before including intuition/iobsoletes.h.
intuition/iobsolete.h is already included by several other include files, i.e. intuition/screens.h. Hence most probably it has been included already at the time you do it explicitly and therefore your own definition of INTUITION_PRE_V36_NAMES comes a bit too late. Better add -DINTUITION_PRE_V36_NAMES to the CFLAGS definition in your Makefile to make sure that the symbol is always defined.
Hence most probably it has been included already at the time you do it explicitly and therefore your own definition of INTUITION_PRE_V36_NAMES comes a bit too late.
Right, i just put it at very top of file and all going well (and -DINTUITION_PRE_V36_NAMES works as well). Thanks
if you want a version free working in 1.3/3.1/4.x... just keep in mind that IntuitionBase is now a struct Library* and was a struct IntuitionBase* in ancient times.
os4 do not like inlines, but want protos instead. it is possible to make proto includes which will not ask on linking stage for linking stub libs, and will works/compiles and on os3 and on os4 the same by the same code ?
proto directories link pragmas or inlines with the source code. If you want to make inlines, hide this in proto directory. For your case, I suggest you to make a proto/music.h for each system or compiler or architecture.
Your compile error with regard to library base types appears to be due to a missing -nostartfiles compile and link option.
You should not be using the C library startup routines in a library.
Simon
Comments made in any post are personal opinion, and are in no-way representative of any commercial entity unless specifically stated as such. ---- http://codebench.co.uk
Inline protos are OK, as long as they are defined in a way that prevents clashes between modules.
If you say "INLINE <type> MyFunc()" in a global header that all modules can read, then each module will export the name MyFunc() and you'll get multiple definitions. You have to change the inline definition to:
static INLINE <type> MyFunc(...)
Put that in your global proto header and no module will export the address to conflict with others.
The real problem with inlines/protos looks like this:
I need to use any kind of includes, so they will works _without_ stub libs. Thats very important: to have those includes done in a way to not have any undefs on linking.
I.e. i have in code PlayModule()/IsModule()/etc function which come from some music library and which uses in the library on which i works, like this:
// Open music library?
if(MUSICBase=OpenLibrary("dopus5:libs/inovamusic.library",0))
{
short ret;
// Ask library
ret=IsModule(handle->name);
// Close library
CloseLibrary(MUSICBase);
.....
So for that originally on sasc #pragmas are used, like this:
So, we have no undefs on linking, as well as i have it compiles fine with gcc. But it is for 68k, and there all those 68k registers, and so on, and of course that kind of inlines will not works when i will try to compile them for os4. More of it, gcc compiler says to me on those inlines (even if we will not take in account 68k registers):
Quote:
error: #error Include <proto/> header files, not <inline/> header files in OS4.
What force me to make new include files, which will give me no undefs on linking stage, and will works on os4 (so protos and not inlines). And so, thats what i want to do:
Will be cool to make a protos which will works and on os3 and on os4 (so that will be easy then later and for aros/mos). It is possible ? Maybe with using of SDI ? If so, how will looks like that string to make it works on gcc for os3/os4 ?:
#define PlayModule(par1, last) \
LP2(0x1e, WORD, PlayModule, char *, par1, a0, BOOL, last, d0, \
, MUSIC_BASE_NAME)