Problems getting C subcommand REXX DLL to work 
Author Message
 Problems getting C subcommand REXX DLL to work

I'm having trouble with REXX subcommands in a C DLL.

I had a nice test DLL (based on the IBM VisualAge C/C++
REXXUTIL example) that worked fine. I copied it,
the def file and the make file and replaced the old
functions with the new ones.

It compiles cleanly.

The def file  is:

   LIBRARY RXDATAFMT INITINSTANCE LONGNAMES
   PROTMODE
   DESCRIPTION 'Data Formatting Functions DLL'
   DATA MULTIPLE NONSHARED
   STACKSIZE 32768
   EXPORTS




Exehdr gives me:

   Library:                        RXDATAFMT
   Description:                    Data Formatting Functions DLL
   Module type:                    Dynamic link library
                                   Per-process initialization
                                   Per-process termination
   Number of memory pages:         00000008 (8)
   Initial CS:EIP:                 object 1 offset 000035cc
   Initial SS:ESP:                 object 0 offset 00000000
   Automatic data object:          3

    no. virtual  virtual  map      map      flags
        address   size    index    size
   0001 00010000 000054e8 00000001 00000006 EXECUTABLE, READABLE, 32-bit
   0002 00020000 00000104 00000007 00000001 READABLE, SHARED, 32-bit
   0003 00030000 00000870 00000008 00000001 READABLE, WRITEABLE, 32-bit

   Exports:
   ord obj  offset    name
     1   1  00000090  LOADFORMATFUNCS exported, shared data
     2   1  00000198  DROPFORMATFUNCS exported, shared data
     3   1  000001fc  MAKEFORMATFUNCLIST exported, shared data
     4   1  0000038c  CRUNCHPC exported, shared data

But then I try the following code:

   loadfunc_name = "LoadFormatFuncs"

   CALL RxFuncDrop loadfunc_name

   IF (RxFuncQuery(loadfunc_name) \= 100) THEN
      DO
         dll_name = "rxdatafmt"
         SAY "Loading" dll_name
         ret_val = RXFUNCADD(loadfunc_name, dll_name, loadfunc_name)
         IF (ret_val \= 0) THEN
            DO
               SAY "Couldn't add" loadfunc_name || ". Return code =" ret_val
               EXIT
            END
         ELSE
            SAY loadfunc_name "loaded."
      END
   ELSE
      SAY loadfunc_name "already loaded."

   CALL LoadFormatFuncs

and it dies with:

   Loading rxdatafmt
   LoadFormatFuncs loaded.
       23 +++   Call LoadFormatFuncs;
   REX0043: Error 43 running F:\tmp\RXDATAFM.CMD, line 23: Routine not found

I'm running OS/2 Warp.

Just to be complete, here are the operative lines from the def file

   rxdatafmt.dll: rxdatafmt.obj rxdatafmt.def
      ILINK /NOFREE /DE /NOLOGO rxdatafmt.obj,rxdatafmt.dll,,REXX,rxdatafmt.def;

   rxdatafmt.obj: rxdatafmt.c
      icc -c -Ge- -Ti+ -Q -DDEBUG $(INCL_DIRS) rxdatafmt.c

Either the first dll I wrote (I thought it was such a breeze :-( ) works
but it really shouldn't or something here is weird.

Any ideas?

Thank you very much (anyone who got this far)

Todd Fox



Mon, 12 Apr 1999 03:00:00 GMT  
 Problems getting C subcommand REXX DLL to work

RxFuncAdd does not verify that the dll is available.
Are you sure that the library is in the dll path?

Saluti, Albert



Mon, 12 Apr 1999 03:00:00 GMT  
 Problems getting C subcommand REXX DLL to work

 TF> F:\tmp\RXDATAFM.CMD, line 23: Routine not found

Make sure the REXX DLL is in your LIBPATH or put a copy of the
REXX DLL in the current directory (here : 'F:\TMP').

Ave,

Andre Doff



Mon, 12 Apr 1999 03:00:00 GMT  
 Problems getting C subcommand REXX DLL to work

Quote:

>The news server wouldn't take my first post so I lost the original
>of the follow-up to my original post BUT a man named Albert had this
>to say about my troubles getting REXX to use my C DLL:

>>RxFuncAdd does not verify that the dll is available.
>>Are you sure that the library is in the dll path?

>>Saluti, Albert

>In short, "yes". As far as I can tell. Everything is in one directory,
>including me, when I run the REXX script. "." is in LIBPATH too.
>That should have me covered, shouldn't it?

>You are right, however. RxFuncAdd doesn't seem too concerned with
>telling me when it can't find something. Fully specifying the path
>to the dll didn't help. Always a return code of 0 (success). Even when
>I tried the dll name

>   dll_name = "Ineedsomesleep"

>(true but definitely nowhere on my hard drive), rxfuncadd happily
>reported success. Is rxfuncadd() broken? What does it take to get
>an error out of it? Out of memory?

>It's spooky that my first attempt at a REXX dll worked just fine.
>I simply replaced some functions and changed the corresponding
>names in the .c, .def and .mak files and suddenly it didn't work
>(with the original and new files in the same directory and all).
>Now I have to wonder if there is some weird/stupid problem in my
>2nd dll or that my first one only works because of some fluke.

>I should have pointed out that my source file has the proper (I
>think) declarations and prototypes, namely

>   RexxFunctionHandler RFLoadFormatFuncs;

>and

>   ULONG RFLoadFormatFuncs(CHAR* name, ULONG numargs, RXSTRING args[],
>                           CHAR* queuename, RXSTRING* retstr)

>(Note, that I've added the prefix RF since my bits of code were first posted.)

>So,

Shouldn't that be ULONG APIENTRY RFLoad... ?

I had some major problems with my Rexx DLL's and Rexx support in my app
until I added the APIENTRY.

Which compiler are you using?

--
Phil Crown

http://web2.airmail.net/pcrown/



Tue, 13 Apr 1999 03:00:00 GMT  
 Problems getting C subcommand REXX DLL to work

 TF> rxfuncadd happily reported success. Is rxfuncadd() broken?

Think of RxFuncAdd 'SysCls','RexxUtil','SysCls' is like adding "If
the *.CMD file sees the 'unknown' function <SysCls>, look in the
file <RexxUtil.DLL> for a function called <SysCls>" to an internal
table. It just makes the function SysCls known to REXX, that's
about it.

 TF> I simply replaced some functions and changed the corresponding
 TF> names in the .c, .def and .mak files and suddenly it didn't work

AFAICS, you changed some other things too, compared to the REXXUTIL
example... I didn't check if that matters.

 TF> I should have pointed out that my source file has the proper
 TF> (I think) declarations and prototypes

Make sure that the version of the DLL that your REXX program uses
(e.t. finds first) includes the RFLoadFormatFuncs, so that it is
not calling an old version of it, without this function.

Ave,

Andre Doff



Tue, 13 Apr 1999 03:00:00 GMT  
 Problems getting C subcommand REXX DLL to work


 PC>TF> ULONG RFLoadFormatFuncs(CHAR* name, ULONG numargs, RXSTRING args[],
 PC>TF>                         CHAR* queuename, RXSTRING* retstr)

 PC> Shouldn't that be ULONG APIENTRY RFLoad... ?

No, or at least that's not required. The only differences I see, related
to the above, with my (working) VAC++ (and C Set++) REXX functions are :

   CHAR *name       instead of CHAR* name
   CHAR *queuename  instead of CHAR* queuename
   RXSTRING *retstr instead of RXSTRING* retstr

Ave,

Andre Doff



Tue, 13 Apr 1999 03:00:00 GMT  
 Problems getting C subcommand REXX DLL to work

Make sure your DLL module name is 8 or less characters long.

Andre



Tue, 13 Apr 1999 03:00:00 GMT  
 Problems getting C subcommand REXX DLL to work

Quote:

>I tried the dll name
>   dll_name = "Ineedsomesleep"

Warp 3 and later require DLL names to be 8.3, max.
--
 .                                             .

 :          DOS - Win16 - Win32 - OS/2         : http://www.40th.com/
 :                                             : BBS:1-210-684-8065


Tue, 13 Apr 1999 03:00:00 GMT  
 Problems getting C subcommand REXX DLL to work

The news server wouldn't take my first post so I lost the original
of the follow-up to my original post BUT a man named Albert had this
to say about my troubles getting REXX to use my C DLL:

Quote:
>RxFuncAdd does not verify that the dll is available.
>Are you sure that the library is in the dll path?
>Saluti, Albert

In short, "yes". As far as I can tell. Everything is in one directory,
including me, when I run the REXX script. "." is in LIBPATH too.
That should have me covered, shouldn't it?

You are right, however. RxFuncAdd doesn't seem too concerned with
telling me when it can't find something. Fully specifying the path
to the dll didn't help. Always a return code of 0 (success). Even when
I tried the dll name

   dll_name = "Ineedsomesleep"

(true but definitely nowhere on my hard drive), rxfuncadd happily
reported success. Is rxfuncadd() broken? What does it take to get
an error out of it? Out of memory?

It's spooky that my first attempt at a REXX dll worked just fine.
I simply replaced some functions and changed the corresponding
names in the .c, .def and .mak files and suddenly it didn't work
(with the original and new files in the same directory and all).
Now I have to wonder if there is some weird/stupid problem in my
2nd dll or that my first one only works because of some fluke.

I should have pointed out that my source file has the proper (I
think) declarations and prototypes, namely

   RexxFunctionHandler RFLoadFormatFuncs;

and

   ULONG RFLoadFormatFuncs(CHAR* name, ULONG numargs, RXSTRING args[],
                           CHAR* queuename, RXSTRING* retstr)

(Note, that I've added the prefix RF since my bits of code were first posted.)

So,

Thanks

Todd Fox



Tue, 13 Apr 1999 03:00:00 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. REXX DLL problems solved (was Re: Problems getting C subcommand to work)

2. Getting .DLLs to work

3. Getting GNAT Ada DLL to work with MSVC++?

4. Getting GNAT Ada DLL to work... clarification

5. HELP: External command (Subcommand) handler to update REXX parameters

6. problem getting pbmake and rcs to work

7. REXX and 4OS2 problem: lower-case text gets converted to upper-case

8. Problem getting a message box to work

9. Problem getting PCS-SCHEME to work with HERCULES mono graphics card

10. problem getting xmlrpclib example to work

11. Troubleshoot: Problem getting Tkinter to work with Python 2.2C1 on Linux

12. Problems getting f2c to work

 

 
Powered by phpBB® Forum Software