On 30/03/2012 15:27, McKown, John wrote:
Thank you very much for the example code. I'm learning quite a bit from reading the LE and Binder manuals. I'm doing 
all my work from a UNIX shell, using UNIX command such as "as" and "ld". One thing that I've 
learned that was non-obvious to me was that the binder needs the parameters "DYNAM(DLL)" and 
"CASE(MIXED)" in order to work properly for my testing.

I don't know why I'm bothering. As you indicated, this does not seem to be of much 
interest. I guess the "real UNIX" programmers are all using C. I would be too, 
if I had access to a z/OS C compiler (and don't mention MVSGCC to me, I'm just not 
capable of getting it to work as I want it to).

One problem with GCCMVS, which I think is what you are refering to, is
that the folks who produced it don't have access to a modern MVS
environment. I have Linux , Solaris, several varients of VMS but no
OS/390 or zOS so its hard to add the bits that make it really usable on
a modern MVS/zOS. You may want to look at Dave Pitts port of GCC to MVS
USS from

http://www.cozx.com/~dpitts/gcc.html.

I think that will run "out of the box" on the current zOS and if you are
working with the shell and LE it may well be just what you need.

--
John McKown
Systems Engineer IV
IT

Dave
G4UGM

Administrative Services Group

HealthMarkets(r)

9151 Boulevard 26 * N. Richland Hills * TX 76010
(817) 255-3225 phone *
[email protected] * www.HealthMarkets.com

Confidentiality Notice: This e-mail message may contain confidential or 
proprietary information. If you are not the intended recipient, please contact 
the sender by reply e-mail and destroy all copies of the original message. 
HealthMarkets(r) is the brand name for products underwritten and issued by the 
insurance subsidiaries of HealthMarkets, Inc. -The Chesapeake Life Insurance 
Company(r), Mid-West National Life Insurance Company of TennesseeSM and The 
MEGA Life and Health Insurance Company.SM



-----Original Message-----
From: IBM Mainframe Assembler List
[mailto:[email protected]] On Behalf Of Steve Comstock
Sent: Friday, March 30, 2012 9:06 AM
To: [email protected]
Subject: Re: curiosity question: How much interest in writing
/ using DLLs in assembler?

On 3/30/2012 7:35 AM, McKown, John wrote:
This question is the outgrowth from my writing UNIX
programs which are
designed to be run from a UNIX shell prompt in HLASM. The
first "outgrowth" was
LE enabling all my UNIX HLASM code. The main reason was to be
able to easily use
some selected C language routines, especially sprintf().
Normally, in HLASM, if
we want to dynamically invoke a subroutine, we do with with a
LOAD/BALR or LINK
function. However, that does not work well for UNIX programs
because, as best as
I can tell, you cannot LOAD or LINK to a program which
resides in a UNIX file.
You must put the subroutine in a PDS or PDSE which is
accessable to the UNIX
process. Which normally means the LINKLIST or via a dataset
referenced in the
STEPLIB environment variable. I am a bit of a "purist". When
I'm wrting a UNIX
command, I want everything to be accessable via normal UNIX
facilities.
I have written a "do nothing" dll in HLASM just to try to
learn how to write
a
DLL in HLASM. I have something that appears to work. Now, I
need to write some
HLASM which attempts to actually use that code.
Has anybody else done anything with DLLs in HLASM? If so,
what did you think
of it? Another use for DLLs that I find interesting is to
have data fields in
them be EXPORTed and referenced from other programs. What is
interesting, to me,
is that all references to a DLL in an LE enclave refer to the
same copy. So any
data which is EXPORTed is, in effect, "global" to the LE
enclave. This seems a
reason way to share data. What say ye?

--
John McKown
Systems Engineer IV
IT

Administrative Services Group

HealthMarkets(r)

Yes, well we cover writing and using DLLs written in Assembler
in our course "Creating and Using DLLs in z/OS"; the course
is multi-lingual in that it discusses creating and invoking
DLLs with C, PL/I, COBOL, and Assembler.

See
http://www.trainersfriend.com/Language_Environment_courses/m52
5descr.htm
for details.

But it seems to be a non-starter: no one has ever requested
that we teach it. Judging by that, I would say there is not
much interest. But, there may be pockets of usage out there.


Note that you can load a module from the HFS using the
BPX1LOD callable service, which may be a simpler solution
to the problem you are describing.

As for invoking a DLL from Assembler, here's some snippets from
code in that course:

LOAD   alias c'dllload'
QUERYF alias c'dllqueryfn'
QUERYV alias c'dllqueryvar
.
.
.

* Load DLL load module CDLL12
*
CALL LOAD,(DLL_NAME),MF=(E,GENCALL)
.
.
.
* Locate DLL function CDSUB4; if successful, call the function
*
          l     2,dll_tok
          CALL  QUERYF,((2),F2_NAME),MF=(E,GENCALL)
          st    15,f2_ptr
          c     15,f0
          be    outa_here
          CALL  (15),(STRING),MF=(E,GENCALL)
.
.
.
* Locate DLL variable data_area; if successful, change it
          l    2,dll_tok
          CALL QUERYV,((2),VAR_NAME),MF=(E,GENCALL)
          st   15,v_ptr
          c    15,f0
          be   outa_here
          mvc  0(l'new_str+1,15),new_str - change value
.
.
.
GENCALL  CALL ,(,,,),MF=L

dll_tok  ds   f

dll_name dc   c'CDLL12'
           dc   x'00'

f2_name  dc   c'CDSUB4'
           dc   x'00'

var_name dc   c'data_area'
           dc   x'00'

string   dc   c'Data from me'
           dc   x'00'

new_str  dc   c'funny little string'
           dc   x'00'


--

Kind regards,

-Steve Comstock
The Trainer's Friend, Inc.

303-355-2752
http://www.trainersfriend.com

* To get a good Return on your Investment, first make an investment!
    + Training your people is an excellent investment

* Try our tool for calculating your Return On Investment
      for training dollars at
    http://www.trainersfriend.com/ROI/roi.html


Reply via email to