Here I go again.
But first of all c is also not my language, but i do come across it a lot (and rewrite).
While learning MUI when I had to open mui library O had to do struct Library *muibase
I find that hard to believe. One exception to that would be if you would use the standard defined muibase variable (which could be specifically typecasted/declared as such).
instead of the tipical struct libbase *libbase...
Are you sure about that ?
Because when i search for struct libbase in complete amiga sdk
, it is non-existant.
Did you perhaps mean struct library *LibBase ?
Why? Does It happends with other libraries?
I hope you understand cos my English is terrible and writing with a smartphone.
A little explanation:
Every library you open with OpenLibrary
returns a pointer to struct library. This means that whenever you open a library a pointer to this structure is returned.
This is because struct library is a common structure that every library _has_ to follow. The structure can be viewed here
So, every opened library has the same set of default fields which is defined in this Library structure. They all have this structure _in common_.
But..., not all libraries are the same _after_ that defined library structure (and therefor its contained/defined fields).
For example, here
you can see the structure of the Graphics library. The structure is called GfxBase.
As you can see, the first entry in that structure is called LibNode and is of type struct Library (the part that is common to all libraries and mentioned in earlier paragraph). If you look beyond that (first LibNode) field, then you can see all other kind of fields being defined (and that might be to interrest to you or your program).
Therefore it does not matter if you use struct library * libbase or struct GfxBase * when you open the graphics library. But when for example your program needs to acces one of the extended defined fields, you better cast your library base to struct GfxBase *.
You can decide yourself if you want to declare you own libbase variable for the library you openend and in what form you want it (being Struct Library* or Struct LibraryStructureName*, where librarystructurename is the library you openened (although not _all_ libraries have an extended library structure).
And there is always the possibility later on (in your code) to cast a Struct Library* into Struct LibraryStructureName* and vice versa).
Does that make sense somewhat, or did i perhaps misunderstood the question ?