Shadowing PFC files

From wiki.visual-prolog.com

Sometimes you wan't to shadow one or more of the official PFC files with your own files.

Here is a way to do this in a "gentle" way.

Let us for the example assume that I want to use my own version of the list package.

Before doing anything my project tree looks like this:

Initial project tree

My project is named shadow_demo and is located in D:\demo\projects\shadow_demo and I want to place my shadow version of the list package inside the directory D:\demo\shadow.

This original files are located in the $(ProDir)\list directory where $(ProDir) is where where my Visual Prolog is installed.

Notice that you can open a file explorer in this directory by selecting the $(ProDir) node in the project tree and select Explore ... (Ctrl+E) in its context menu.

For this "shadow" method it is important that my own files are placed in the same structure as in the original pfc directory (including the pfc level). So I copy the original list files to my the directory D:\demo\shadow\pfc\list.

I want my copied files to shadow the original pfc files and therefore I add the D:\demo\shadow directory as an Include Directory in my project (it will appear with a relative path):

Include directories: shadow directory added

It is important that the shadow include directory is placed above the $(ProDir), so that files found here are used instead of filed found in $(ProDir). I.e. that they shadow the original pfc files.

At this point it is important to delete the original $(ProDir)\pfc\list\list.pack from the project otherwise you may easily end up with "Symbol redefinition" link errors:

Symbol redefinition link errors

After I have deleted the $(ProDir)\pfc\list\list.pack file from the project and rebuild the project I was met by an "Add required " dialog:

Add required shadow list package

And I added the package. Now the project tree (actually, after closing and reopening the project in the IDE) looks like this:

After rebuild (shadow appearing in project tree)

The list package no longer appears in the $(ProDir) directory. But now I have a list package in ..\..\shadow\pfc\list and these files will then be used instead of the original pfc files in the project. And I can modify them as I want.