Welcome Guest. Please Login or Register. Mar 31st, 2018, 11:41pm
ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018. We apologize Conforums does not have any export functions to migrate data. Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.
Thank you Conforums members.
Cross-platform BBC BASIC (Windows, Linux x86, Mac OS-X, Android, iOS, Raspberry Pi)
Re: RISC OS Sprite reader
« Reply #16 on: Jun 24th, 2017, 09:22am »
Quote:
I wouldn't be surprised if the calling conventions (ABI) are not what you would normally expect for a DLL - I didn't add any stdcall directives - but BB4W is pretty tolerant and will call either stdcall or cdecl functions equally well.
Indeed that already would be one of my concerns if 'it' would compile and link with correct calling conventions. Also I'm unaware that something like "__attribute__ (dllexport)" would make it compile as DLL.
I didn't react to the offer yet as I was still trying to grasp the new info sofar. Filling the BMPfile{} structure the correct way is interesting as well.
All in all, the above was a nice exercise. Maybe nice for a Wiki article explaining how to turn a simple C-program into a DLL so that the code can be used in BB4W via SYS.
compile and link with correct calling conventions.
I think your concern may be misplaced. It's not really a case of 'correct' or 'incorrect' calling conventions; I've come across several DLLs that have a 'non-standard' ABI but so long as they are used in the context of a specific application (as in this case being intended for use with BB4W) I don't see that as a problem.
The BOX2DBBC DLL uses an even less standard calling convention, one that even SYS cannot call straightforwardly, but since it is intended to be used only with the BB4W BOX2D library again I don't see that as an issue.
Quote:
Also I'm unaware that something like "__attribute__ (dllexport)" would make it compile as DLL.
Google is your friend. Although I'd done it several times before, I couldn't remember anything about how to make a DLL, so I just looked it up. The only thing that makes my memory-loss manageable is Google - it's interesting (and slightly disconcerning) how often my searches find a reference that I myself have posted or published, but which I've subsequently completely forgotten about!
Quote:
Maybe nice for a Wiki article explaining how to turn a simple C-program into a DLL so that the code can be used in BB4W via SYS.
I'm not too sure how that is different from "how to turn a simple C program into a DLL" which is something very easily found already. The "so that the code can be used in BB4W via SYS" doesn't really impose any extra constraints, other than the ABI issue; stdcall and cdecl are both fine.
But feel free to write such a BB4W Wiki article and copy/adapt the information you can find elsewhere, so long as Copyright restrictions permit you to do so.