I need to understand the name resolution in XSharp.

This forum is meant for questions about the Visual FoxPro Language support in X#.

Post Reply
jpmoschi
Posts: 77
Joined: Thu May 21, 2020 3:45 pm

I need to understand the name resolution in XSharp.

Post by jpmoschi »

I need to understand the name resolution in XSharp.
My background is VFP where "names" are resolved in order of loading into memory.
For example:
do ProcOrFunc with par1, par2, ...
First of all, the name ProcOrFunc is searched in memory It may have been previously loaded into memory by the program flow that was loading all the procedures contained in each program file refered.
Suppous the next a program flow

do prg1
...
set procedure to prg3
do prg2
---
do ProcOrFunc ...
etc...

If ProcOrFunc name is not found in memory, that is, it exists as a procedure contained in some prgfile of the call stack, finally it looks for it as a file with the name ProcOrFunc.fxp or ProcOrFunc.prg. Just then, if you can't find it, it generates the error "File ProcOrFunc.prg that not exist".

What happens in XSharp?
I Created a WindowsFormsApplication with:
- Form1.prg
- CodeFile1.prg

I have the error XS0103 when trayng to call a public procedure or function created inside CodeFile1.prg
from a method or event inside the Form1 class that inherits from System.Windows.Forms.Form


best regard
Please, be patient with VFP structured brain
Robert, you can undestand this looking my foxpro Example
User avatar
Chris
Posts: 4906
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

I need to understand the name resolution in XSharp.

Post by Chris »

The fundamental difference in X# is that it is not using an interpreter, instead the code is getting compiled as a whole into exes and dlls, and any procedure/function call needs to be available when compiling. What you did with calling the procedure from another file, should work of course, but maybe there's some difference with the parameters you passed when calling it (since X# supports overloading of procs/metods etc). Can you please show us exactly how the procedure is declared and how you are calling it?

Btw, having said the above, after some time I think it will be probably possible to emulate some of the CFP way of calling procedures, but that's something for the future.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
Post Reply