08-17-2007
11:51 AM
- last edited on
05-21-2025
01:30 PM
by
Content Cleaner
// MathFuncsDll.h
namespace
MathFuncs
{
class MyMathFuncs
{
public:
// Returns a + b
static __declspec(dllexport) double Add(double a, double b);
};
}
Source file
// MathFuncsDll.cpp
// compile with: /EHsc /LD
#include
"MathFuncsDll.h"
#include <stdexcept>
using
namespace std;
namespace
MathFuncs
{
double MyMathFuncs::Add(double a, double b)
{
return a + b;
}
}
08-17-2007 01:46 PM
Hi
happybird,
The LabVIEW Call Library Function Node cannot call C++ class methods and
properties from a DLL directly. You will need to export wrapper C Style
functions (functions exported with extern "C") to be able to use them
with the Call Library Function Node. The extern "C" statement is
required to instruct the VC++ compiler to not mangle the exported function
names, which is what a C++ compiler does by default.
I would check out the Using External Code in
LabVIEW and Calling Shared Libraries
help topics in the LabVIEW Help (Navigate to Contents >> Fundamentals
>> Calling Code Written in Text-Based Programming Languages >>
Concepts)
Best Regards,