Constructor for the wwDotNetBridge class. Allows specification of the .NET runtime to be used via optional parameter. Last optional parameter determines whether .NET runtime is loaded directly into VFP or whether the .NET component is loaded via COM Interop.

loBridge = CREATEOBJECT("wwDotNetBridge","v4.0.30319",.F.)

You can specify the following values for the version (at the time of writing):

  • V2 or V4
  • Specific version numbers like v2.0.50727 or v4.0.30319

The default currently is V4 which is the version of the compiled wwDotNetBridge component. We highly recommend you always use V4 as that's the most widely available and pre-installed version of .NET today.

The runtime can be specified only on the first creation of the wwDotNetBridge object within the calling process (VFP Application) - all subsequent version number requests are ignored as the existing runtime is used for all other components loaded.

The logical llUseCom parameter allows to specify whether the wwDotNetBridge .NET component hosts the .NET runtime (.F. which is default) or whether COM Interop activation (ie. CreateObject()) is used to instantiate it.

Note that if you are targeting a specific version of .NET you might have to add the following to either VFP9.exe.config or YourApp.exe.config:

<?xml version="1.0"?>
    <supportedRuntime version="v4.0.30319" />
    <!-- supportedRuntime version="v2.0.50727"/ -->

This ensures that wwDotNetBridge will run in the correct version of the .NET runtime. You still need to specify explicitly which version of the .NET runtime you want if you choose one other than the default version.

o.wwDotNetBridge.Init(lcDotNetVersion, llUseComInterop)


Valid version strings are:

  • V4
  • V2
  • v4.0.30319
  • v2.0.50727 The latter two are specific version numbers in the .NET version format. The two versions listed are the only relevant versions in use today but you can use a different version number should a new major version of .NET arrive (unlikely given the .NET Core is a differrent runtime that doesn't support COM).

If .T. wwDotNetBridge will not host the .NET runtime explicitly but rather invoke the wwDotNetBridge .NET component as a plain COM object. If .T. you have to make sure that wwDotNetBridge.dll is registered as a .NET COM object.

If .F. (default) wwDotNetBridge will host the .NET runtime internally and load the wwDotNetBridge .NET component into it. No COM registration for wwDotNetBridge is required in this case.

Use .T. only if you are interoperating with COM Interop invoked .NET components (ie. CreateObject("ProgIdForDotNetComponent")) and you have problems with crashes. If you already use COM interop there's no need to also host the .NET runtime manually to avoid overhead.

See also:

Class wwDotNetBridge

© West Wind Technologies, 1996-2024 • Updated: 05/23/17
Comment or report problem with topic