GetwwDotNetBridge

Factory method that can be used to create a PUBLIC instance of the wwDotNetBridge class. Use this method instead of explicitly instantiating the class to avoid recreating the .NET object wrapper object each time.

This helper caches the .NET hosted proxy instance so it doesn't have to be reinstantiated each time you CREATEOBJECT(). Instead the cached instance is returned if it exists.

Here's how to use it:

DO wwDotNetBridge    && load the load library
loBridge = GetwwDotNetBridge()

loBridge.LoadAssembly("FULLPATH('rtfConverter.dll')")
loConverter = loBridge.CreateInstance("rtfConverter.rtfConverter")
GetwwDotNetBridge(lcVersion)

Parameters

lcDotnetVersion
Optional - specify the .NET version that is to be loaded. If not specified the highest version is loaded. Default is "V4"

Remarks

This is a static function not a method of the class.

loBridge = GetwwDotnetBridge()

.NET is loaded only once

The .NET runtime can only load once into Visual FoxPro so the first time wwDotnetBridge is loaded determines which version of .NET is loaded. Any subsequent version requests are ignored.

To ensure that the proper version of .NET is used in your application we recommend you add a call to GetwwDotnetBridge (or CreateObject("wwDotnetBridge")) somewhere in your application startup code with the version you wish to load:

*** in your startup code
GetwwDotnetBridge("V4")  && forces .NET 4.x for entire app

See also:

Class wwDotNetBridge

© West Wind Technologies, 2023 • Updated: 01/11/23
Comment or report problem with topic