1. Open Microsoft Visual Studio 2008, and then create a new Proyect:
Type the name of proyect, i have used creatingDLLs
2. In the wizard select:
3. In the solution Explorer window look the file dllmain.cpp and
4. Delete the default content of creatingDLLs.cpp and paste the code below:
#include "stdafx.h"
#include <windows.h>
#include <string.h>
#include <ctype.h>
#include "creatingDLLs.h"
/* Define all the functions to use */
extern "C" __declspec (dllexport) long sum_num(long, long);
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved )
{
return TRUE;
}
/* Add two integers */
_declspec (dllexport) long sum_num(long a, long b){
return((long)(a+b));}
5. Create a Header file into the Headers Folder named creatingDLLs.h where the functions to be loaded in lab view will be defined; just like in the creatingDLLs.cpp file definition of functions. I.e. paste the code below into the file creatingDLLs.h
extern "C" __declspec (dllexport) long sum_num(long, long);
6. In the Generate Menu, click Generate Solution
8. Ready!! Now look for the .dll and .h files into the working folder to create the link.
9. Select VIs for Shared Library
10. Click Next, the times to be necesary till window shown below
11. And click Finish. Your Library Instance should appear. Drag the .vi file which contents the function created in c++m into the Block Diagram, and ready. You get your C++ function into LabView acting from DLL file.