× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



That's exactly what I'm talking about. I just needed to think a little farther outside the box.

And theoretically as long as I don't include the procedure in the binder source, I could call them all the same thing (e.g., just srvpgm_init).  Then I write the C++ module once and include it in every service program I create.

This is fantastic.



On 3/27/2019 4:33 PM, Mihael Schmidt wrote:
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 thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.