FuncAdd external library functions

FuncAdd external library functions

Post by kjactiv » Sat, 22 Nov 2003 03:44:11


I'm working on a project to convert ORexx, Regina, Arexx & Reginald
rexx etc. scripts to different platforms but do have some problem with
Regina...

The RexxRegisterSubcomDll() function /* I believe that's the function
to def */

This function is used to set up a routine that is located in a module
in a dynamic link library, as a subcommand handler. Some operating
systems don't have dynamic linking, and thus cannot make use of this
facility. The prototype of this function is:

APIRET APIENTRY RexxRegisterSubcomDll(
PSZ EnvName,
PSZ ModuleName,
PFN EntryPoint,
PUCHAR UserArea,
ULONG DropAuth

How do I funcdef a list of all functions from a external library in
regina ones and all in one or do I have to do this manually, every
used function one and all...

and is it posible to funcdef external library functions at all in
regina and how please...

sorry as a new commer to regina...

Ke Johansson



This function is not yet supported by Regina.
 
 
 

FuncAdd external library functions

Post by ptjm » Sat, 22 Nov 2003 13:35:44

In article < XXXX@XXXXX.COM >,


% This function is used to set up a routine that is located in a module
% in a dynamic link library, as a subcommand handler. Some operating
% systems don't have dynamic linking, and thus cannot make use of this
% facility. The prototype of this function is:
%
% APIRET APIENTRY RexxRegisterSubcomDll(
% PSZ EnvName,
% PSZ ModuleName,
% PFN EntryPoint,
% PUCHAR UserArea,
% ULONG DropAuth
%
% How do I funcdef a list of all functions from a external library in
% regina ones and all in one or do I have to do this manually, every
% used function one and all...

This seems like a non-sequitor. If you have a list of functions, you
can call RexxRegisterFunctionDll() for each of them. If the platform
you're working on has no dynamic linking, then you obviously can't have
a function defined in an external library, can you?

% and is it posible to funcdef external library functions at all in
% regina and how please...

% This function is not yet supported by Regina.

This appeared below your name, and I'm not sure what was meant by it, but
if it's supposed to be an error message emitted by Regina, I can't find
it in the sources. What platform are you working on?

In any case, whatever your problem is, you don't have to use the
Register*Dll functions just because your functions are in a DLL.
So long as the function names are resolved at the time you call
the register functions, you can use RexxRegisterFunctionExe and
pass a function pointer. I always do this in LoadFuncs-type functions,
because it allows shared libraries to be renamed without changing
the source code and recompiling.

--

Patrick TJ McPhee
East York Canada
XXXX@XXXXX.COM

 
 
 

FuncAdd external library functions

Post by Jeff Glat » Sun, 23 Nov 2003 00:47:14

gt; XXXX@XXXXX.COM


Kare,

I'm sort of confused over what you're doing. Are you writing some software in
C? Because RexxRegisterSubcomDll() would normally be called only by a C program
(ie, not a REXX script).

Most of the REXX interpreters for personal computers have some APIs that are
intended to be called by programs written in compiled languages such as C/C++
(or Fortran or even assembly language, etc). In other words, the interpreter
not only runs REXX scripts -- it also provides a way for software written in
_other_ languages to launch REXX scripts, add new functions (written in a
language such as C) that are callable by that REXX script, and in general
interact (ie, exchange data) with that REXX script.

RexxRegisterSubcomDll() is one such API. RexxRegisterFunctionDll() is another
such API. Interpreters such as Reginald, Regina, and Object REXX have these
C/fortran/assembly/etc callable functions.

The purpose of RexxRegisterFunctionDll is to allow a program written in C, for
example, to add new functions designed for a REXX script to call. These
functions would normally be written in C. And by using RexxRegisterFunctionDll,
the C program makes these callable by your REXX script without your script
needing to use the REXX built-in function RXFUNCADD. (Think of RXFUNCADD as the
REXX script's version of the C callable RexxRegisterFunctionDll).

For example, you know that RexxEd makes special functions available to your
script to call such as EditGetDoc(), EditGetText(), etc. RexxEd is written in
C. EditGetDoc, EditGetText, etc, are C functions inside of my exe. I called
Reginald's RexxRegisterFunctionDll to make them available to any script that
RexxEd runs. Your script doesn't need to call RXFUNCADD to define EditGetDoc,
EditGetText, etc, because my C program does that for you using
RexxRegisterFunctionDll.

Contrast this with REXX Dialog. Because REXX Dialog does not call
RexxRegisterFunctionDll, your script needs to call RXFUNCADD to add the REXX
Dialog functions such as RXMSG, RXCREATE, etc. (Ok, actually you have to
RXFUNCADD only one REXX Dialog function, RXDLGLOADFUNCS, and call it once.
RXDLGLOADFUNCS actually does call RexxRegisterFunctionDll to register each and
every one of the _other_ REXX Dialog functions. Otherwise, you would need to
call RXFUNCADD for every one of them. And yes, Reginald's auto-load feature
eliminates the need to even RXFUNCADD and call RXDLGLOADFUNCS, because that's
what the auto-load feature essentially does).

What I think you're really asking about is "How does a REXX script register
functions in a DLL?". The answer to that is, if the DLL is written to support
REXX, such as REXX Dialog, MIDI Rexx, some DLLs that Patrick or Florian make,
etc, then you need to use RXFUNCADD to register each and every function you
intend to call. (But like REXX Dialog, typically these DLLs give you one
function to RXFUNCADD, and when you call this, it registers all of the other
functions on your behalf. In REXX Dialog, this is called RXDLGLOADFUNCS, but
other DLLs will have their own name for it. For example, MIDI Rexx has
MIDILOADFUNCS. One of Patrick's DLLs has a SYSLOADFUNCS).

But, if you want to register functions in a DLL that is not specifically
designed to support REXX, such as a Windows operating system DLL like
USER32.DLL, then you need to use some proprietary method (and hope the
interpreter supports that). For example, Reginald offers FUNCDEF,
 
 
 

FuncAdd external library functions

Post by Seymour » Sun, 23 Nov 2003 02:33:23

In <bpk4n0$h2p$ XXXX@XXXXX.COM >, on 11/21/2003
at 05:35 AM, XXXX@XXXXX.COM (Patrick TJ McPhee) said:


What do you mean by "dynamic" linking? It isn't synonymous with DLL.
Certainly in CMS and MVS a REXX program can dynamically call a routine
that is not in a DLL. A REXX program can also call routines in a
function package that is not in a DLL.

--
Shmuel (Seymour J.) Metz, SysProg and JOAT

Unsolicited bulk E-mail will be subject to legal action. I reserve
the right to publicly post or ridicule any abusive E-mail.

Reply to domain Patriot dot net user shmuel+news to contact me. Do
not reply to XXXX@XXXXX.COM
 
 
 

FuncAdd external library functions

Post by ptjm » Sun, 23 Nov 2003 04:52:56

In article <3fbe4c63$1$fuzhry+tra$ XXXX@XXXXX.COM >,

% In <bpk4n0$h2p$ XXXX@XXXXX.COM >, on 11/21/2003
% at 05:35 AM, XXXX@XXXXX.COM (Patrick TJ McPhee) said:
%
% >This seems like a non-sequitor. If you have a list of functions, you
% >can call RexxRegisterFunctionDll() for each of them. If the platform
% >you're working on has no dynamic linking, then you obviously can't
% >have a function defined in an external library, can you?
%
% What do you mean by "dynamic" linking? It isn't synonymous with DLL.

The ability to load executable text from a file external to the module
from which the process was created, based on program logic. DLL is an
acronym for a kind of file which contains executable text and indices
into the text -- it is certainly not synonymous with dynamic linking,
but is synonymous with `shared object' or `shared library', the names
that come up most often on Unix systems.

% Certainly in CMS and MVS a REXX program can dynamically call a routine
% that is not in a DLL.

Why would you say it's not in a DLL? Because it's not called a DLL, or
because there's some conceptual difference between the way these
routines are called and the way routines are called from DLLs?

% A REXX program can also call routines in a
% function package that is not in a DLL.

Meaning what? That it's a collection of Rexx-language functions, or
that it's a collection of executable text in a library that doesn't
happen to be called DLL on that platform?

But RexxRegisterFunctionDll() is not something you can call from a Rexx
program. It's part of the SAA API and the discussion centres around
functions written in compiled languages, notable C and its derivatives.
There is an equivalent function which can be called from Rexx programs
directly, and which is usually supported on platforms which provide
the SAA API, but I'm not sure if the OP is interested in that.

--

Patrick TJ McPhee
East York Canada
XXXX@XXXXX.COM
 
 
 

FuncAdd external library functions

Post by Seymour » Mon, 24 Nov 2003 10:13:07

In <bplqen$4bu$ XXXX@XXXXX.COM >, on 11/21/2003
at 08:52 PM, XXXX@XXXXX.COM (Patrick TJ McPhee) said:


No it is not. A DLL is a particular type of shared library.


Because it isn't. A DLL is a type of object with a particular type of
interface, and it is not the only type of object that can store
external routines.


Both the way that they are called and the way that they are packaged.
In both CMS and MVS I can call an external routine from REXX without
first registering it. I can't do that with a routine in a DLL.


Meaning that a REXX program can also call routines in a function
package that is not in a DLL. It does not need to first register the
routine, as it would for a routine in a DLL.


REXX-callable, not written in REXX. A function package is similar to a
DLL, in that it has several routines bound together, but it is
different in that it is specific to REXX and uses REXX calling
sequences rather than the normal calling sequences of its host.


It's not something that you need to call in order to call an external
function. It's not relevant to external functions that are not in a
DLL.


Il va sans dire. I've written such functions, and have not needed to
put them in a DLL to call them, although I have sometimes found it
convenient to package them in REXX function packages.

--
Shmuel (Seymour J.) Metz, SysProg and JOAT

Unsolicited bulk E-mail will be subject to legal action. I reserve
the right to publicly post or ridicule any abusive E-mail.

Reply to domain Patriot dot net user shmuel+news to contact me. Do
not reply to XXXX@XXXXX.COM
 
 
 

FuncAdd external library functions

Post by ptjm » Tue, 25 Nov 2003 08:53:53

In article <3fc009a3$1$fuzhry+tra$ XXXX@XXXXX.COM >,


% Both the way that they are called and the way that they are packaged.
% In both CMS and MVS I can call an external routine from REXX without
% first registering it. I can't do that with a routine in a DLL.

That's certainly not true. In practice, there are mechanisms for calling
routines from DLLs without registering them first, and in theory,
there's absolutely no reason for registration functions like
RexxRegisterFunctionDll to exist. In practice, some Rexx implementations
use them, but that's just because someone decided to do it that way.

% >But RexxRegisterFunctionDll() is not something you can call from a
% >Rexx program
%
% It's not something that you need to call in order to call an external
% function. It's not relevant to external functions that are not in a
% DLL.

It's not clear to me what your point is, but it doesn't seem like you're
making a distinction between `functions in DLLs' and `external
functions', but rather between Rexx implementations which require
functions in DLLs to be registered, and Rexx implementations which
don't. You may feel free to provide some details if I'm wrong, but I
presume your `external functions' sit in a file which is some sort of
library, and that the Rexx implementation searches this file, or some
set of files which it's programmed to recognise, for external functions.
Implementations which support the SAA API could do exactly the same
thing, although to my knowledge none of them do. This has nothing to do
with the nature of the libraries, but with the way the Rexx
implementations themselves work. It doesn't seem like there's a useful
distinction between DLLs and other kinds of libraries of compiled
functions, for a start.
--

Patrick TJ McPhee
East York Canada
XXXX@XXXXX.COM
 
 
 

FuncAdd external library functions

Post by imc » Tue, 25 Nov 2003 21:49:24

Shmuel (Seymour J.) Metz entertained comp.lang.rexx with the following
story:

It's not an a priori necessity that routines stored in a DLL must be
registered - that's just a current widely-used convention.
--
---- Ian Collier : XXXX@XXXXX.COM : WWW page (including REXX section):
------ http://www.yqcomputer.com/

New to this group? Answers to frequently-asked questions can be had from
http://www.yqcomputer.com/
 
 
 

FuncAdd external library functions

Post by Florian Gr » Tue, 25 Nov 2003 22:35:21


XXXX@XXXXX.COM schrieb:
>

is missing and returns an error like the exit stuff. Yes that's right
and will be fixed in 3.3 final which will be released around chrismas
hopefully.

RexxRegisterExitDll() doesn't work, too. Another error needs to be fixed.
RexxDeregisterFunction doesn't unload a loaded DLL allocated by
RxFuncAdd or RxFuncDefine or RexxRegisterFunctionDll.

---

Others have shown their opinion at different places of the thread. Mine
is that RexxRegister???Dll is the only clean way to be sure that the
interpreter won't crash. Loading a library and using RexxRegister???Exe
isn't safe if another script or function or hook tries to unload the
library.

Final note: Even ORexx doesn't follow the SAA documentation. The
various error cases are handled in another way as documented.


You have to do it on your own. The best solution is to create a
loader function that is called by your script as the first function
which registers all other exported functions.


RexxRegisterFunctionDll should work for a long time already. Registering
hooks can be made doing a local lookup for the entries and then doing
a RexxRegister???Exe as already stated.


You only have to apologise if you don't come to Regina ;-)

Cheers, Florian
 
 
 

FuncAdd external library functions

Post by Seymour » Wed, 26 Nov 2003 11:29:00

In <bprhag$nbk$ XXXX@XXXXX.COM >, on 11/24/2003
at 12:53 AM, XXXX@XXXXX.COM (Patrick TJ McPhee) said:


My point is that an external subroutine can be dynamically called from
other objects than a DLL.


Which part of "a REXX program can also call routines in a function
package that is not in a DLL." don't you understand? Which part of
"and have not needed to put them in a DLL to call them, " don't you
understand?


For MVS, yes; for CMS it need not be in a library.


When neither the operating system nor the REXX implementation treat
them the same, when the API is different and the utilities for
managing them are different, then it doesn't seem like its useful to
pretend that the differences aren't there.

--
Shmuel (Seymour J.) Metz, SysProg and JOAT

Unsolicited bulk E-mail will be subject to legal action. I reserve
the right to publicly post or ridicule any abusive E-mail.

Reply to domain Patriot dot net user shmuel+news to contact me. Do
not reply to XXXX@XXXXX.COM
 
 
 

FuncAdd external library functions

Post by Seymour » Wed, 26 Nov 2003 11:30:49

In < XXXX@XXXXX.COM >, on 11/24/2003
at 12:49 PM, XXXX@XXXXX.COM (Ian Collier) said:


Understood, but that's a secondary issue. The primary issue is that a
DLL is only one type of library, and that I can and have dynamically
called REXX aware subroutines from other types of libraries.

--
Shmuel (Seymour J.) Metz, SysProg and JOAT

Unsolicited bulk E-mail will be subject to legal action. I reserve
the right to publicly post or ridicule any abusive E-mail.

Reply to domain Patriot dot net user shmuel+news to contact me. Do
not reply to XXXX@XXXXX.COM
 
 
 

FuncAdd external library functions

Post by Jeff Glat » Wed, 26 Nov 2003 14:40:30

>"Shmuel (Seymour J.) Metz"

Who the hell cares what you *think* is the "primary issue". Kare asked
specifically about loading DLLs containing REXX-callable functions,
particularly in regards to Regina and Reginald. (He already was given the
answer he needed, and now has updated his REXX software in accordance with that
information).

Perhaps if you learned how to actually read posts, and refrained from
substituting your own ridiculous straw man arguments, you wouldn't be
constantly guilty of idiotic topic drift that serves no useful purpose to
people who come here looking for help with REXX.
 
 
 

FuncAdd external library functions

Post by Wolfgang R » Wed, 26 Nov 2003 19:22:35


brexx (dos) has/d
call load "rexxfile.r"

and use its functions anywhere after invocation.

This was quite handy in those limited times,
but as there was no unload, you where bitten a bit later.

Wolfgang
 
 
 

FuncAdd external library functions

Post by Jeremy C B » Thu, 27 Nov 2003 00:56:12

In article <3fc2be6c$32$fuzhry+tra$ XXXX@XXXXX.COM >,




Indeed not.

And incidentally the Regina ported onto (ex-)Acorn's RISC OS also
doesn't support the DLL stuff, because there's no such concept on this
OS either.

--
Jeremy C B Nicoll - my opinions are my own.