Poster | Thread |
Drule
| |
OS4 ARexx library host function Posted on 21-Nov-2018 13:53:48
| | [ #1 ] |
|
|
|
Amiga Developer Team |
Joined: 11-Jun-2004 Posts: 49
From: Harrogate, UK | | |
|
| I'm looking at writing a library which utilises a rexx host function under OS4 but am having a little difficulty with the invocation. I've based the initial implementation on the example in the 3.9 NDK tutorial. In its simplest form the script is just,
Quote:
/* an example rexx function call */ SAY "Working.." ADDLIB( "ks.library", 0, -30, 0) CALL MyFunc( 123 )
|
..with the function signature as..
Quote:
int32 _rexx_dispatch( struct Interface *, struct RexxMsg *, STRPTR *) |
I've added the dispatch function entry point as the "first" function of the library to just write to debug and returns ERR10_001. Opening the library and invoking the function directly works but running the rexx script causes a grim reaper. It looks like the rexx libraries are still 68K and I don't know if I need to do something else before my PPC function can be called; is the offset still -30 for OS4 (I'm assuming so as ExamineDT works for datatypes)? Do I need some kind of shim?
The NDK example is a little vague as it has a precompiled "RexxDispatchGlue" function linked instead of the "RexxDispatch".
Does anyone have any idea or docs that might prove insightful?_________________ Karma: Positive |
|
Status: Offline |
|
|
thomas
| |
Re: OS4 ARexx library host function Posted on 21-Nov-2018 15:16:50
| | [ #2 ] |
|
|
|
Super Member |
Joined: 28-May-2003 Posts: 1143
From: Germany | | |
|
| @Drule
In order to be called from 68k programs your library needs a 68k vector table.
Add the CLT_Vector68K tag to your libCreateTags array. The 68k vector table contains the usual Open/Close/Reserved/Expunge entries as well as your dispatch function.
The entries in the 68k vector table do not point directly to your PPC functions, there are two steps in between. The 68k vector points to a struct EmuTrap which in turn points to a PPC stub function. The PPC stub function gets one parameter: a pointer to a uint32 array containing the 68k register values. It has to pick the parameters from the respective registers in this array and can then finally call your real PPC library function.
I am not sure but I think that IDLTool can build a skeleton for you.
Last edited by thomas on 21-Nov-2018 at 03:21 PM.
_________________ Email: thomas-rapp@web.de Home: thomas-rapp.homepage.t-online.de |
|
Status: Offline |
|
|
Drule
| |
Re: OS4 ARexx library host function Posted on 21-Nov-2018 15:23:26
| | [ #3 ] |
|
|
|
Amiga Developer Team |
Joined: 11-Jun-2004 Posts: 49
From: Harrogate, UK | | |
|
| @thomas
Thanks very much for the info - makes sense. I'll see what havoc I can cause with that :) _________________ Karma: Positive |
|
Status: Offline |
|
|
Drule
| |
Re: OS4 ARexx library host function Posted on 21-Nov-2018 16:07:26
| | [ #4 ] |
|
|
|
Amiga Developer Team |
Joined: 11-Jun-2004 Posts: 49
From: Harrogate, UK | | |
|
| @thomas
I'm pleased to report you were spot on - with the stubs and 68K vector table in place, my function is now being called. Thanks very much for that. _________________ Karma: Positive |
|
Status: Offline |
|
|