Logo

Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.

Sys(2339)

Starting in VFP 7, this function sets the value of an internal VFP variable that determines whether references to unused libraries are cleaned up when a COM object is released.

Usage

cValue = SYS( 2339, nOption )

Parameter

Value

Meaning

nOption

Omitted

Returns the current value.

0

Don't call the CoFreeUnusedLibraries Windows API function when the DLL is released.

1

Call the CoFreeUnusedLibraries Windows API function when the DLL is released.

cValue

Character

The character value of the option passed.

In VFP 6, the internal variable, g_CallCoFreeOnRelease, was set to 1, which meant that VFP released libraries that were no longer used upon releasing the COM object. However, in VFP 7, this is changed to 0, so they are NOT released when the COM object is. Why? Microsoft says because it increases performance, especially for multi-threaded DLLs. If you recompile your VFP 6 DLLs, and see an improvement, especially in an intensive environment, this is probably why. If, on the other hand, you start encountering weird errors, this could be why, too, and try flipping it back to its VFP 6 default.

Note that when you rebuild a DLL, all the references to the unused libraries are cleaned up.

Example

* When upgrading VFP 6 code, be sure to add
* this line to achieve the same effect in VFP 7.
SYS(2339, 1)

See Also

Build MTDLL, Sys()