Hands up - it usually is my fault, Jon!

Big thank you to Barbara and your good self for clearing that up - makes perfect sense now. (And by the same reasoning, EXPORT is not needed in the equivalent Cycle Main code because everything in the main procedure - including the PR - is global anyway?)

Thanks for clarifying - the subtlety  has been tripping me up!

Brian.

On 15/05/2024 17:40, Jon Paris wrote:
Thanks Barbara,

So it was all Brian's fault <grin>


Jon P.

On May 15, 2024, at 12:24 PM, Barbara Morris <bmorris@xxxxxxxxxx> wrote:

On 2024-05-15 12:15 p.m., Jon Paris wrote:
Interesting Brian,
Perhaps Barbara will pop-in and explain (or tell us it is a bug) - but the "cure" is to remove your proto for the Msg() routine. I never code those anyway since they became optional so it is not a situation I would normally encounter.
Remove the Pr and the bind error disappears and all works as expected.
...
If you have a PR for a procedure in the module, it should be a global PR, to match the procedure which is also global within the module.

When you have a PR inside a procedure, it is a local prototype, private to that procedure. The compiler doesn't consider whether it is a procedure within the module, so it gets listed as an import when you create the module. That's why it works when you export the procedure.

The solution is to either move the prototype out of the linear main procedure or just remove the prototype entirely.

--
Barbara


--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.



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.