From: Rick M. <obj...@gm...> - 2009-04-25 12:34:06
|
On Sat, Apr 25, 2009 at 8:15 AM, Rony G. Flatscher <Ron...@wu...> wrote: > Hi, > > a few little questions, before being able to go further at the moment: > > How would one be able to define some RexxPackageLoader function named > "testLoader" in C++ code such that it can be used in the RexxPackageEntry > field "loader"? > (Would just need the correct function header and the first statement in the > body for accessing the context object!) The oorexxapi.h header defines the type signatures of the loader and unloader function. The signatures typedef void (RexxEntry *RexxPackageLoader)(RexxThreadContext *); typedef void (RexxEntry *RexxPackageUnloader)(RexxThreadContext *); The RexxThreadContext instance is for the instance that initiated the load operations. The load is performed on a process basis, so you'll only see one of these. And, like all thread context calls, any objects references you cache in your C++ needs to be globally protected by using RequestGlobalReference() (and released using ReleaseGlobalReference() in the unloader). > > Would this loader (and the matching unloader) be called once for each > RexxInstance that loads/requires the library or would it be called once for > all the RexxInstances in a process? > Only once per process. > The function RexxGetPackage() loads the library indicated in the > OOREXX_GET_PACKAGE(package) stub. If a library got loaded as part of the new > RexxCreateInterpreter using the option LOAD_REQUIRED_LIBRARY or via the > loadLibrary()-API, then does RexxGetPackage() get executed as well? It's all the same mechanism. > > If so, how could one load a different set of functions/routines that are > defined in a different package library in the same dll/so and causing the > RexxGetPackage() to *not* be executed anymore, if a Rexx program requires > that very same dll/so later on? Huh? A package is a self-contained entitiy, and it defines just one set of information. If you wish to have other packages sharing code, then create a small DLL that only defines the package functions you require but link to the larger body of code for the actual implementation. > [Use case: if the Rexx interpreter gets invoked via Java, then the external > functions to load or unload Java itself must not be made available. Hence > one would need to create another package with the desired external > functions, but how would one load that package then, as currently it seems > that one needs to use the name of the dll/so library?] Use multiple packages, like I indicated. > > Are all loaded native routines (via requires-library or the loadLibrary-API) > available to all programs running under a certain RexxInstance or visible > among all RexxInstances in a process? They are all visibile globally. > > TIA, > > ---rony > > > > ------------------------------------------------------------------------------ > Crystal Reports - New Free Runtime and 30 Day Trial > Check out the new simplified licensign option that enables unlimited > royalty-free distribution of the report engine for externally facing > server and web deployment. > http://p.sf.net/sfu/businessobjects > _______________________________________________ > Oorexx-devel mailing list > Oor...@li... > https://lists.sourceforge.net/lists/listinfo/oorexx-devel > > |