· May 6, 2016

Load a dll at run time

I am using java gateway imported/proxy classes and JG business service. I need to load a dll at run time.

I use System.loadLibrary/System.load when in java. I’ve tried $ZF(-3,” C:\Windows\System32\pteidlibj.dll”) and $ZF(-4,1,"C:\Windows\System32\pteidlibj.dll") but I’m getting <DYNAMIC LIBRARY LOAD> error.

How can I load a dll at run time using COS?

Discussion (5)1
Log in or sign up to continue

When running the following: $ZF(-4,1,"C:\Windows\System32\pteidlibj.dll"), I’m getting DYNAMIC LIBRARY LOAD and nothing is written to cconsloe.

If I use $ZF(-4,1,"pteidlibj.dll"), the error persists but I’m getting this on cconsole: (4584) 1 Error loading dll (c:\intersystems\ensemble\mgr\testing\pteidlibj.dll) is 126.

In my java code, I’m using: System.load("C:/Windows/System32/pteidlibj.dll"), dll is properly loaded. It’s exactly the same dll.

I would like to add that $zf(-3) and $zf(-4,1) calls can only be used to load what we call a callout library. This is a specific DLL that properly exports functions during linking and  exposes them in a ZFENTRY table. You can find more material about the callout gateway in this part of the documentation:

If you want to work with a specific DLL that is not a callout library, you have to wrap the library, e.g. in a Java jar library or a callout DLL and then call out from Caché Object Script.

The project Evgeny mentioned may be of help as well.