24 January 2023, 04:24 | #1 |
Registered User
Join Date: May 2022
Location: Adelaide, South Australia, Australia
Posts: 208
|
Visual Studio Code Amiga C Extension
I'm having problems with includes. As far as I can tell, I just include
<proto/xxx>for whatever library I want to use. However including <proto/alib.h>throws a ton of errors. Attached is the output when I try to build with it included. Although, I would appreciate if someone would point me to working implementations of CreateExtIO()and DeleteExtIO(), because I'd be just fine programming them in myself, but I can't figure out what needs to be initialised in the IORequeststructure. I've already made my own CreatePort()and DeletePort(). Thanks in advance. |
24 January 2023, 05:45 | #2 |
Registered User
Join Date: Jun 2016
Location: europe
Posts: 1,039
|
Something like:
Code:
createextio(reply_port, size): io = AllocMem(size,MEMF_CLEAR|MEMF_PUBLIC); // handle failed alloc io->io_Message.mn_Node.ln_Type = NT_REPLYMSG; io->io_Message.mn_Length = size; io->io_Message.mn_ReplyPort = reply_port; return io; deleteextio(io): if (io) FreeMem(io,io->io_Message.mn_Length); |
24 January 2023, 06:51 | #3 | |
Registered User
Join Date: May 2022
Location: Adelaide, South Australia, Australia
Posts: 208
|
Quote:
PS: Also do I have to abort the IORequest before removing it? The documentation says it's dangerous to abort a request that's never been used, how do I check if it's been used or not? Last edited by Steam Ranger; 24 January 2023 at 07:10. |
|
24 January 2023, 17:33 | #4 |
Registered User
Join Date: Jun 2016
Location: europe
Posts: 1,039
|
Yeah, NT_REPLYMSG tells that the previous I/O had been replied and is fully complete, and the request is ready for another or to be freed. Length is there so that you know whether it's standard, extended, etc. (how much extra data is there). ReplyPort is optional, it's there because typically it's always the same one so you fill it in once.
Other properties you have to fill in prior to doing an actual I/O, based on device, I/O type, etc. You should only (try to, since it's not a 100% guarantee, there are device specific considerations) abort if it's in progress (if you haven't replied yet). If the type is set to NT_REPLYMSG, as I mentioned above, it's done. |
25 January 2023, 01:44 | #5 |
Registered User
Join Date: May 2022
Location: Adelaide, South Australia, Australia
Posts: 208
|
I'm running into a problem with the timer device.
Here's the code I'm using to open it: Code:
Devices.h Code:
Timer.h TimerBase, and yet when GetSysTime()is called it gives this in a pop-up: Failed to get Stack Trace: Cannot access memory at address 0xaea00f8 (from data-disassemble -s 0x0aea00f8 -e 0x0aea015c -- 5) And outputs this: B-Trap FFFF at 000A9CD2 -> 00F80AE8 Please help... |
25 January 2023, 03:29 | #6 |
Registered User
Join Date: Jun 2016
Location: europe
Posts: 1,039
|
Probably not related, but...
1. NewList macro is not using its parameter list, looks like there's a hardcoded outside variable in the first line, right-hand side. It should probably be: struct List *_NewList_list = list; 2. NewList macro again, why ({...})? () is typically associated with function calls, you should probably only use {} |
25 January 2023, 04:24 | #7 |
Registered User
Join Date: May 2022
Location: Adelaide, South Australia, Australia
Posts: 208
|
I copied character for character the existing newlist macro, as for whatever reason the one in my includes wasn't working.
|
25 January 2023, 12:38 | #8 |
Registered User
Join Date: May 2022
Location: Adelaide, South Australia, Australia
Posts: 208
|
Here's
Timer.hand Devices.h, incase more info is needed. I cannot figure out why this isn't working, especially since no part of the opening process gives an error. It just all worked correctly and then WinUAE Error 3. They've got *.cextensions just so I can upload them, but they're *.hFiles. |
25 January 2023, 15:57 | #9 |
Registered User
Join Date: Jun 2016
Location: europe
Posts: 1,039
|
AbortIOInProgress should use != instead of == (you're aborting if type == NT_REPLYMSG).
And again, what is the purpose of ({...})? After NewList macro expansion you end up with if (...) {...} else ({...}) instead of if (...) {...} else {...} I don't know what compiler you're using, if it's a gcc port it could be OK since this is not a valid c, it's a gcc extension, and I don't know what will other compilers produce. In any case there's no need for () because, as far as I can see, macro is not intended to be used as a right-hand expression (it would always "return" 0). |
25 January 2023, 17:55 | #10 |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,216
|
Is there actually a reason why you don't use NewList() in amiga.lib, CreateMsgPort() in exec and CreateExtIO() in exec? Or their corresponding counterparts from amiga.lib?
|
26 January 2023, 01:41 | #11 |
Registered User
Join Date: May 2022
Location: Adelaide, South Australia, Australia
Posts: 208
|
Whenever I include it it throws errors because of
_stdargsor something before every function definition, but if I splice those out of the file the functions fail. So I decided to make my own set of functions, which also has the benefit that I can tweak them to have additional features. PS: NewListby default expands to have those brackets around it, but even once I've removed them it doesn't alter the functionality one bit. Also, I'm using gcc 8. Last edited by Steam Ranger; 26 January 2023 at 01:43. Reason: PS |
26 January 2023, 11:56 | #12 |
Registered User
Join Date: May 2022
Location: Adelaide, South Australia, Australia
Posts: 208
|
Ah, I just realised. In
GetTimestamp()my intention was to create a struct timevalin stack memory, pass a pointer to it into GetSysTime()and then return some values from it. I forgot that declaring a pointer to the structure doesn't create it, but instead you have to declare the structure and use &to get a pointer. Thanks for your help anyway. Last edited by Steam Ranger; 26 January 2023 at 11:56. Reason: Smiley |
26 January 2023, 14:39 | #13 | |||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
Quote:
__stdargsas in clib/compiler_specific.h: Code:
#if (defined(__GNUC__) && defined(AMIGA)) || defined(__SASC) #define __STDARGS__ __stdargs Quote:
_stdargsattribute is for those compilers which don't. Which makes it especially annoying when such an attribute is missing. Maybe there is an option for the command line? Quote:
Or switch to a more compatible compiler. My observation is that the version of a gcc-port directly correlates to the incompatibility with classic AmigaOS compilers. |
|||
09 March 2023, 20:59 | #14 |
Registered User
Join Date: Jan 2023
Location: Nice, France
Age: 55
Posts: 13
|
I'm also using gcc from the BartmanAbyss VS code extension (like you, if I have a look at your first attached file), and to get rid of the errors I just "undefine" __stdargs by specifying -D__stdargs= in the Makefile at the end of the CCFLAGS (and then I write my own code of the alib functions I want to use)
|
04 September 2023, 00:57 | #15 | |
Registered User
Join Date: Jul 2017
Location: Oxford
Posts: 104
|
Quote:
Now I wonder: why is that? I can't see anything Win (nor Darwin) specific in the includes under the extension folder... also, where could I find an example `clib/compiler_specific.h` file? NB. Using that -D setting did the trick, although there were a few extra quirks under windows, eventually *it seems* to have compiled. Will check if it works tomorrow. |
|
06 September 2023, 11:48 | #16 | |
Registered User
Join Date: Aug 2010
Location: Germany
Posts: 532
|
Quote:
The NDK3.2R4 'C' header files were last updated in February 2022 and AmigaOS NDK 3.2 Release 5 is still in the works. While the version of "compiler-specific.h" in NDK 3.2R4 is not as good as it could possibly be (vbcc, gcc support need updating, and thanks to both Christian Sauer & Frank Wille, will be improved in release 5), it should see you through. Please check if your current 'C' header files are much older than what you can find in the AmigaOS NDK 3.2 Release 4 archive. As a rule, you should not be forced to reimplement the fundamental functions which the native development kit already provides for you. Last edited by Olaf Barthel; 06 September 2023 at 13:01. |
|
07 September 2023, 00:40 | #17 | |
Registered User
Join Date: Jul 2017
Location: Oxford
Posts: 104
|
Quote:
What puzzled me is that the same code compiles in OSX, gives errors in Windows. The OS includes seem to be the same. |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Amiga Assembly extension for Visual Studio Code | prb28 | Coders. Asm / Hardware | 342 | 15 December 2023 21:22 |
Amiga GCC 8.3+gdb extension for Visual Studio Code | Bartman | Coders. C/C++ | 117 | 11 March 2023 20:06 |
Issue getting started with amiga-debug Visual Studio Code Extension (Windows) | dalton | Coders. General | 2 | 23 June 2022 21:02 |
Amiga Assembly exension for Visual Studio Code 0.19 released | prb28 | Coders. General | 2 | 02 January 2020 18:34 |
Visual Studio Code Blitz Basic extension | earok | Coders. Blitz Basic | 29 | 16 July 2019 17:59 |
|
|