从 z/OS 上的 DLL cobol 程序动态调用 NODLL cobol 程序

发布于 2024-07-14 21:20:19 字数 108 浏览 3 评论 0原文

在使用 Enterprise Cobol for z/OS 的大型机上,是否可以从已使用 NODLL 编译的 cobol 程序动态 CALL Cobol Dyamic 链接库 (DLL) 程序?

On the mainframe using Enterprise Cobol for z/OS, is it possible to dynamically CALL a Cobol Dyamic link library (DLL) program from a cobol program that has been compiled with NODLL?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

遥远的绿洲 2024-07-21 21:20:19

有很多种方法可以做你想做的事。

如果动态调用是指通过数据定义变量进行调用,我认为您不能使用链接器/绑定器来执行此操作,因为绑定器需要在绑定时知道目标函数。

您必须专门dllload DLL 加载模块、dllqueryfn 函数并以这种方式调用它。

要使用链接器/绑定器,我相信需要执行以下步骤(P1 是执行调用的 NODLL COBOL 程序,P2 是< code>DLL 程序被调用):

  • P2 必须使用 DLL 选项进行编译和绑定。
  • P1 必须使用 NODYNAM 进行编译并与 DLL 绑定。
  • P1 必须包含CALL 'dll-func'(即,仅文字调用)。
  • 绑定P1时,SYSLIB必须首先指向P2位置。

这将导致绑定器将 P1P2 合并到一个加载模块中,这不完全是 DLL 调用,但我认为除了dllload/dllqueryfn 解决方案。

我使用了旧式的 dll 函数,但是,如果您的水平足够高,还可以使用较新的 dlopen/dlsym C 辅助函数。

此页面为我的论点提供了支持,即 NODLL/DLL 程序只有在绑定到单个加载模块时才能相互调用。 但是,您仍然必须使用静态调用。

此页面提供了另一个选项,您可以将 DLL 程序放入与调用程序相同的加载模块中,并使用静态调用来获取它。 看起来该 DLL 程序可以调用该加载模块中的其他 DLL 程序。 因此,可以在DLL程序中提供静态网关函数,该函数可以动态调用不在加载模块中的DLL函数。 这超出了我在大铁杆上做过的任何事情,所以你必须尝试一下。

这两个页面均来自 publib-boulder 站点,使用 IBM 产品的每个人都应该了解这些站点(还有红皮书/红纸站点)。

对于我来说,我更喜欢 dllload/dllqueryfn 解决方案,因为这是我在 AIX 和其他 UNIX 中习惯使用的解决方案,而且它似乎提供了最大的灵活性。

There are a number of ways to do what you want.

If, by dynamically call, you mean call via a data definition variable, I don't think you can do this with the linker/binder since the binder needs to know the target functions at bind time.

You have to specifically dllload the DLL load module, dllqueryfn the function and call it that way.

To use the linker/binder, I believe the following steps are required (P1 is the NODLL COBOL program doing the calling, P2 is the DLL program being called):

  • P2 must be compiled and bound with the DLL option.
  • P1 must be compiled with NODYNAM and bound with DLL.
  • P1 must contain CALL 'dll-func' (i.e., literal calls only).
  • When binding P1, SYSLIB must first point to the P2 location.

This will cause the binder to incorporate both P1 and P2 into a single load module which is not exactly DLL calling but I don't think there's any way around that other than the dllload/dllqueryfn solution.

I've used the older-style dll-functions but, if you're at a high-enough level, there are also the newer dlopen/dlsym C helper functions.

This page provides support for my contention that NODLL/DLL programs can only call each other if bound into a single load module. You still have to use static calls however.

This page offers up another option, where you can put the DLL program into the same load module as the calling program and use static calls to get to it. It seems that the DLL program can call other DLL programs not in that load module. So it may be possible to provide a static gateway function in the DLL program that can dynamically call a DLL function not in the load module. This is beyond anything I've ever done on the big iron so you'll have to experiment.

Both those pages are from the publib-boulder sites which everyone using an IBM product should know about (along with the redbooks/redpapers site as well).

Me, I prefer the dllload/dllqueryfn solution since that's what I'm used to from AIX and other UNIXes and it seems to provide maximum flexibility.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文