using Silk Performer; // C# imports Silk Performer // VB.NET
For example:
Bdl.Print("This is a message from within a .NET Assembly");The functions that are defined by the BDL class can only be used if the .NET assembly runs in a virtual user. This is because perfrun.exe functions (virtual user process) will be called.
Sample Bdf Script
dcltrans transaction TMain var hObject, hObject2 : number; hReturn : number; begin DotNetSetString(hObject, "ConstrValue1"); hObject := DotNetLoadObject("bin\\Release\\TestDriver.dll", "TestDriver.TestClass"); hObject2 := DotNetLoadObject("bin\\Release\\TestDriver.dll", "TestDriver.ParamClass"); DotNetSetFloat(hObject, 1.23); DotNetSetInt(hObject, 123); DotNetCallMethod(hObject,"TestMethod"); DotNetGetObject(hObject, hReturnValue); DotNetFreeObject(hObject); DotNetFreeObject(hObject2); DotNetFreeObject(hReturn); end TMain;
Sample .NET Code (C#)
using System;
using Silk Performer;
namespace TestDriver
{
public class TestClass
{
public TestClass(string sConstrValue)
{
Bdl.Print("Constructor called with param" + sConstrValue);
}
public TestClass()
{
Bdl.Print("Default Constructor called!");
}
public ParamClass TestMethod(double fParam, int nParam)
{
return new ParamClass(fParam, nParam);
}
}
public class ParamClass
{
public double mfMember;
public int mnMember;
public ParamClass(double fParam, int nParam)
{
mfMember = fParam;
mnMember = nParam;
}
public ParamClass()
{
mfMember = 0.0;
mnMember = 0;
}
}
}