Question External DLL calls in Classes?

Cringer

ProgressTalk.com Moderator
Staff member
Is it possible to put calls to External DLLs in Classes? I'm trying to move a load of stuff from a massive super-proc into a class so it's easier to use, and just wondering if it's possible, and how? Progress 11.2.1.
 

Osborne

Active Member
Does kbase P133258 - http://knowledgebase.progress.com/articles/Article/P133258 - cover what you are trying to achieve?:
It is not possible to define code like the following within an ABL class...

PROCEDURE SomeCall EXTERNAL "Some.dll":
.
.
END PROCEDURE.

Prior to OpenEdge 10.2B this restriction can be worked around by putting the external procedure call into a .p then writing a wrapper program which would invoke the DLL / shared library routine and return the results.

In OpenEdge 10.2B and later you are able to call a DLL / shared library by using the CALL object. Please see the CREATE CALL statement in the documentation for further details. This code can be placed within a METHOD in the class.
 

TomBascom

Curmudgeon
This works:
Code:
class i4gl:

  procedure putenv external "/lib64/libc.so.6" persistent:
    define input  parameter env as character.
    define return parameter x   as long.
  end.

  method public static void os-putenv( envName as character, envValue as character ):

    define variable r as integer no-undo.

    run putenv( substitute( “&1=&2” envName, envValue ), output r ).

  end.

end class.
 
Top