Writing modules
Malcolm Hussain-Gambles (1596) 811 posts |
I’m attempting to write a module, the first thing I’m struggling with is a function called module_base. One thing that I notice is that the BatMgrHal sources seem to be using a slightly different format of makefile than I’m using, I’ve based mine on the ones out of the DDE example. Am I better spending some time at the beginning using this different format, is this the “new” one? |
Rick Murray (539) 13840 posts |
Not much detail about what you want to use this for, so I assume you are writing it in C and needing a pointer to the base address of your module? If so, you will need to generate an assembler file that looks like this:
In your C program, you do this:
It can then be accessed like any other variable (note – variable, not a function). In your MakeFile, you compile the C code, you assemble the assembler code, and you pass the names of all of the object files (o.blah) in the Link command. !Make (or !AMU) will work out what is necessary, build it if needs be, then paste all the pieces together. |
Rick Murray (539) 13840 posts |
Try also… http://www.chiark.greenend.org.uk/~theom/riscos/docs/CodeStds/ASDTF.txt |
Malcolm Hussain-Gambles (1596) 811 posts |
Thanks Rick, I’ve already worked out the assembler and the C side of things. Obvious I know, but I’m incredibly rusty. FYI it’s a module to handle (initially) sockets. One side will copy data off the socket buffer into a dynamic memory area. The wimp side of things will then actually deal with the data it’s read. But now I’ve got the thing compiling again, I can continue on my un-relenting quest for pain! Thanks again, really appreciate the assistance! |
Steve Pampling (1551) 8170 posts |
When you start looking you will find the DNS functionality to be somewhat less than it ought to be. Basically the network stack is elderly and back when it was done it was a quick and dirty effort. |
Malcolm Hussain-Gambles (1596) 811 posts |
Funny you should mention DNS, it’s the first thing I want to look at. The current lookup method is just not suitable as for starters it’s a sync process, so if DNS is down etc. then it just locks up RISC OS until the timeouts kick in, which as you say is “sub-optimal” ;-) Yeah I think the forward has bugs with multiple A records. One thing I was thinking of doing for a laugh was a load-balancer for RISC OS, perhaps call it “Nut-Scraper” ;-) |
Steve Pampling (1551) 8170 posts |
Reverse lookup has, IIRC, an assumption of the domain suffix. Deficiencies in the Resolver module were what caused Frank de Bruijn (AntiSpam maintainer) to write an alternate module for that purpose. As he said a little while back (CSA* or here?) it isn’t a complete resolver, but I suspect it might be a useful starting point.
Use? |
Malcolm Hussain-Gambles (1596) 811 posts |
Thanks for that I’ll take a look. Use? “for a laugh” – I thought having a usable load-balancer running on RISC OS maybe a useful edge case say running on a Pi. Priorities are: |
Steve Pampling (1551) 8170 posts |
13 probably needs to move up to join item 6 maybe earlier. |
Malcolm Hussain-Gambles (1596) 811 posts |
Agreed, but I know enough about encryption to know it should probably come after 14, or possibly I should add: After a quick google I found this |
Malcolm Hussain-Gambles (1596) 811 posts |
I’ve noticed that there seems to be a preference to using OSLIB rather than toolbox in the modules. Update: Nevermind, getting a module working on the desktop is a waste of my time. I’m still getting Aborts when I try and initialise. I’ll never get the thing written that way. |