-1

I have the Xsteam.dll file that works in all of my LABVIEW projects properly; but now I want use it (Xsteam.dll) in a simple visual C++ project (in visual studio 2013 or ...).

I dont have any other file related it (such as *.h , *.lib and etc).

I know that the Xsteam.dll written in c/c++ language and I know all of its functions and variable types of their inputs and outputs arg.

I usually use the Xsteam.dll in LABVIEW at this setting:

library name or path:    c:\XSteam.dll         
function name:            h_pT          
thread:               run in UI thread           
calling convention:      stdcall(WINAPI)                  
function prototype :  double h_pT@16(double arg1, double arg2);       

return type :   Numeric 8-byte double          
arg1:     Numeric 8-byte double    Pass: Value             
arg2:    Numeric 8-byte double      Pass: Value                   

prototype for these procedures: 
                                 MgErr Proc(InstanceDataPtr *instanceState);

How to use Xsteam.dll by a simple Vc++ program?

Remi Guan
  • 21,506
  • 17
  • 64
  • 87
nanosi
  • 21
  • 6
  • Be careful to check that the DLL matches your C++ program, ie don't mix 32bit and 64bit dlls and programs. – Mikhail Oct 22 '15 at 01:48
  • Can you use this .dll? and then give me its codes? This simple project can be very useful for the other people that they have same problem and your work is very important. by the way your guidance is great. – nanosi Oct 23 '15 at 19:44

2 Answers2

2
example:
HMODULE hModule = LoadLibrary("c:\\XSteam.dll");
typedef double  (* FNPTR) (double , double );
                FNPTR pfn = (FNPTR)hModule.GetProc("h_pT");
                if ( NULL != pfn )
                {
                    double result=pfn(arg1, arg2);
                }
Nandu
  • 808
  • 7
  • 10
1

You'll need to make a header file and use dumpbin and lib to create an import library (*.lib). Look here or here.

Community
  • 1
  • 1
kjpus
  • 509
  • 4
  • 8
  • First off, you'll need to make a header file. Since you already know the function signatures, you can do that easily, e.g. `extern "C" __declspec(dllimport) double h_pT(double, double)`. Then, run dumpbin on the dll as described in the link to generate a .def file. Run lib on the .def file to generate a .lib file. Finally, you'll use the .lib file with your program during linking. – kjpus Oct 22 '15 at 20:10