##- # Author: Brian Tiffin # Dedicated to the public domain # # Date: December 2016 # Modified: 2017-01-03/01:42-0500 ##+ # # testcob.icn, test calling COBOL without wrapper # $include "natives.inc" procedure main() # will be RTLD_LAZY | RTLD_GLOBAL (so add to the search path) addLibrary := loadfunc("./uninative.so", "addLibrary") # allow arbitrary C functions, marshalled by a small piece of assembler native := loadfunc("./uninative.so", "native") # add the testing functions to the dlsym search path, # the handle is somewhat irrelevant, but won't be soonish dlHandle := addLibrary("./cobolnative.so") # initialize GnuCOBOL native("cob_init", TYPEVOID) # pass two integers, get back a sum ans := native("cobolnative", TYPEINT, 40, 2) write("Unicon: called sample and got ", ans) # rundown the libcob runtime native("cob_tidy", TYPEVOID) end