Oppolzer - Informatik / Blog

Blog-Hauptseite      Neuester Artikel      Älterer Artikel      Neuerer Artikel      Älterer gleiche Kategorie      Neuerer gleiche Kategorie

ASSEMBLER-L - DLLs von ASSEMBLER-Programmen aus aufrufen


Re: DLL's in assembler.


Bernd Oppolzer <bernd.oppolzer@T-ONLINE.DE>




2002.11.05 05:06:15

Hi all,

as others have explained, calling DLLs from ASSEMBLER is not easy.

We are using a different approach, and we did it a long time, even before
IBM-DLLs were available.

We created a file with entry names and module names in it, like this:



From that file, we generate ASSEMBLER stubs for each entry (little CSECTs),
which load the required module (MVS LOAD), if not already done (we store the
EPA statically in the stub), and call the required module. The stubs are linked
to the caller instead of the original functions.

The module (for example, module1) contains all the original functions entry11,
entry12, ... The stub passes a number to the module, which specifies the
desired entry. On top of the module, there is a generated ASSEMBLER switch,
which passes control to the appropriate section or entry (with V address)
by using this number, coming from the stub. And, before passing control to
the required entry, we restore the original registers of the caller. The called
function returns to the original caller, not to the stub.

That is, all calls of entry11, entry12, entry13 and so on are translated in the
stub in a call to module1 (same entry on top of module1); the stub puts the
number of the desired entry in a register (in our system: R8, but it could be
any other register), and in module1, this number is used to branch to the
desired entry.

This way, we can have callers in C, PL/1 and ASSEMBLER, and the DLL functions
(entry11, ...) can also be coded in C, PL/1 and ASSEMBLER. The additional
overhead for passing control to the DLLs (module1, module2, ...) is pretty low.

This are, of course, not IBM-DLLs, but our own technique, but they work in
almost the same way. I know of one other site, which is using a similar

From time to time, the company discusses the migration to IBM-DLLs, but at the
moment, we stay with our own approach. Remember: IBM-DLLs require special
compile and linker options and so on ...

We are z/OS 1.3, and we didn't change this mechanism since 1995 (was some
older release of OS/390). This approach survived all OS (and LE) changes.

Kind regards


Am Mon, 04 Nov 2002 schrieben Sie:
> I'm new to the list, and I've perused the archives looking for an answer, prior
> to this post.  Here goes:
> Can a DLL be written in assembler? (HLASM rel 4?)
> It seems if one were able to, the use of XOBJECT (GOFF?) option(s) would be
> required, along with use of XATTR and/or CATTR directives.
> Thanks,
> J.Y.

Blog-Hauptseite      Neuester Artikel      Älterer Artikel      Neuerer Artikel      Älterer gleiche Kategorie      Neuerer gleiche Kategorie