|
There is another way which includes some tiny C++ code. You code an C++ source file like this
extern "C" { int jsona_srvpgm_init(void); }
static int dummyInitVar = jsona_srvpgm_init();
And compile it as an ILE C++ module. And you create a procedure in your RPG code, in this example jsona_srvpgm_init(). You bind it all together to a service program.
Now your RPG procedure will get called when the service program is loaded.
I use this in my JSON Utilties service program, http://rpgnextgen.com/index.php?content=download#json .
This concept is from an article from Bob Cozzi on systeminetwork. http://systeminetwork.com/node/26462
Hope this helps.
Best regards
Mihael
On 27.03.19 21:26, Joe Pluta wrote:
Is there any way to invoke a specific procedure when a service program is first activated? For example, to load configuration information. I can use a pretty simple brute force design pattern: every procedure in the service program calls an internal procedure called init(), and the first thing init() does is check a static variable to see if it's already been called. I don't have a problem with that technique, but I was just wondering if I was missing something a little more elegant.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.