SET LIBRARY TO 'xxxxxxprogram.prg' ADDITIVE & DO 'xxxxxxprogram.prg'

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

Post Reply
Paul.Newman
Posts: 1
Joined: Thu Jul 28, 2022 6:49 am

SET LIBRARY TO 'xxxxxxprogram.prg' ADDITIVE & DO 'xxxxxxprogram.prg'

Post by Paul.Newman »

Hello Forum,

Could anyone help with the following.

SET LIBRARY TO 'xxxxxxprogram.prg' ADDITIVE

DO 'xxxxxxprogram.prg' WITH (variable)

How would I integrate this VFP code in XSHARP VFP console app?

Many thanks
User avatar
robert
Posts: 4558
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

SET LIBRARY TO 'xxxxxxprogram.prg' ADDITIVE & DO 'xxxxxxprogram.prg'

Post by robert »

Paul,

FoxPro works with PRG files at runtime.
X# (and most other languages) work a bit different:
the sources are included in a project at compile time and are bundled into an output assembly (DLL or EXE) as binary code.
This binary code is run at runtime.
That is why the "SET LIBRARY " command does not really make sense in X#.
If you have common code that you want to use from multiple locations then you would create a library in VS as well. Use the "Class Library" template for that.
Then in your main app (the console app) you add a reference to the Class Library project.
This will create 2 assemblies.
- One for the class library (DLL)
- One for the main app (EXE)

You distribute these 2 assemblies and the X# runtime DLLs.

Of course you can also include the code from the library program in the main app. In that case you only get one assembly (the EXE).
Please note: if you "Add" an existing item to a VS project then VS creates a copy of that file in the project.
If you want to share a file between projects you should add what is called a "Linked Item".
On the "Add Existing Item" dialog there is a down arrow next to the [Add] button. Choose [Add As Link] to add the existing file as link. This will NOT copy the file to your project. That way you can share the same file between projects.
We do that all the time for common files, like the files that contain our version information. This is shared between all projects in the same solution, so they all have the same version number.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
Post Reply