Sample Blog Post
How to Call a Custom C# DLL in VuGen
Step 1: Create a Custom C# DLL
using System;
namespace CustomFunctions
{
public class CustomFunctions
{
public static string HelloWorld()
{
return "Hello, World!";
}
}
}
Step 2: Prepare VuGen Environment
Place the generated DLL file in a location accessible by VuGen.
Step 3: Call the Custom DLL in VuGen
extern "C" int lr_load_dll(const char *lpLibFileName);
extern "C" void HelloWorld();
Action()
{
lr_load_dll("path_to_dll\\CustomFunctions.dll");
HelloWorld();
return 0;
}
Example
#include "lrun.h"
extern "C" int lr_load_dll(const char *lpLibFileName);
extern "C" void HelloWorld();
Action()
{
lr_load_dll("path_to_dll\\CustomFunctions.dll");
HelloWorld();
return 0;
}
Syntax
Declaration in C#
using System;
namespace CustomFunctions
{
public class CustomFunctions
{
public static string HelloWorld()
{
return "Hello, World!";
}
}
}
Declaration in VuGen (C)
extern "C" int lr_load_dll(const char *lpLibFileName);
extern "C" void HelloWorld();
Loading DLL and Calling Function in VuGen (C)
lr_load_dll("path_to_dll\\CustomFunctions.dll");
HelloWorld();