FNC type API vs. API Call

Bob Smucker, also known as the world-famous Object Curmudgeon, sheds some light on the differences between the two "API" concepts in Obsydian. This was posted on Synposium. I think it explains the differences between the two concepts very well. The tip for same-platform calls will help anyone who has struggled with this little quirk (described below) of Obsydian.

Subject: API functions and API calls

This points out the unfortunate choice of similar wording used to describe two different Obsydian procedures, which makes 'calling an API' a bit ambiguous.

First, there are functions of type API, which are invoked by a normal Call statement. Such functions are external to Obsydian, such as hand-coded RPG or CL programs. They are supposed to work across platforms, but there have been problems with parameter mappings.

We have made a practice of scoping API functions to a 'normal' External function on the same platform, and calling the API function only from the scoping function. This allows us to add whatever logic is needed to get a meaningful *Returned status, and to replace the API function with minimal impact later if desired. As a bonus, we've never had the parameter mapping problems others have reported, since it is always a same-platform call.

Second, objects of type Source code are invoked with an API Call statement. This is equivalent to ExcUsrSrc to the /2E veteran. For obvious reasons, C++ source code doesn't work in an RPG function, and vice versa.

'OBAS400/Execute a command' is a Source code object that will only work in an RPG program. As Martin points out, you can easily create a function of type External and language RPG400 which does this and nothing else, so that you can Call it from a WinC function.

I hope this long-winded explanation helps some confused soul out there.

 

 

Send mail to webmaster@obsydian.com with questions or comments about this web site.
Copyright © 1998-2002 SynapTech Consulting
Last modified: March 17, 2002