KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Checking for externals embedded in a Windows 4D database structure
PRODUCT: 4D | VERSION: 3.x | PLATFORM: Win
Published On: May 5, 2000

Before 4D version 3.2.5, plug-ins were known as "externals," and they were installed by using the "External Mover" utility that physically merged them into the structure file. In May, 1995, 4D 3.2.5 introduced a new "plug-in" architecture, where plug-ins are kept outside of the structure as separate files in a Mac4DX folder. For the sake of backwards compatibility, the old method of installing externals in the structure still worked.

With the introduction of version 3.5, 4D was now able to run on the Windows platform as well as Macintosh. The Windows and Macintosh versions of plug-ins were now required to be stored in respective Win4DX and Mac4DX folders. In some databases that had originally been developed on a Macintosh, forgotten Macintosh externals remained embedded in the structure.

If you have any old externals installed in a database structure that has been converted to 4D v6 or higher, they can cause all sorts of strange problems. To check for these old externals, you can open the database in 4D Insider. If you open the structure up with empty Win4DX and Mac4DX folders, the only plug-in listed should be "_4D Chart". In 4D v6 and higher, 4D Chart is installed in 4D.EXE (the data fork of the 4D application).

On Macintosh, you can see old external routines listed at the end of commands listed in the lower-right corner of the method editor. But on Windows, old external routines do not show up there even when they are present in the structure.

So if you don't see externals listed in the method editor or in 4D Insider, that still doesn't guarantee that there couldn't be some fragment of an external still lurking in your structure, causing you trouble.

It's easier to check for the presence of old externals (or any of their leftover fragments) on the Macintosh platform, but here are some tricks you can use on Windows.

If you have any externals still installed in your structure, they will be located in the resource fork of the structure (in the ".RSR" file).

Check to see if the .RSR file of your structure is larger than 1K. If so, it probably contains externals, or some other non-standard resources. If the .RSR file is 1K or less, that doesn't absolutely disprove the presence of an external, but it's unlikely.

Add the following method to your database:

In the 4D User Environment, choose " target="_blank">Execute Method..." from the Special menu, and select this method.

The "Open resource file" command will present a dialog asking you to open a file. Select the ".RSR" file of your database structure. The code then builds an array "resTypesArray" that lists the types of resources contained inside the resource fork of your structure file. You can view the contents of this array in the debugger by clicking on the name of the array in the debugger's code window.

Now you can see exactly what types of resources are in the structure's resource file. In a newly created blank database, there will be only two or three resources: "IN4D", "STR ", and "4D4D". Those are the only resources that you would normally find. Some developers like to add their own custom resources, typically pictures and strings, in resources like "PICT", "STR ", "STR#", and "TEXT". But if you see a "4DEX" resource, that contains old 4D externals. The old-style externals also installed other types of resources, such as "4BND", "4DTE", and others.

For more info, see Removing legacy resources from a 4th Dimension database structure (MacOS)
Here is a text version of the code shown above that you can cut and paste into your own project:

resFile:=Open resource file("")
ARRAY LONGINT(resTypesArray;0)
RESOURCE TYPE LIST(resTypesArray;resFile)
TRACE