Solved! Go to Solution.
Try replacing the header file with the text below (for unknown reasons, the forum won't let me upload it). The function calls use simple types, so there's a good chance that the DLL Import Wizard will be able to handle it using this header file. For some reason the DLL Import Wizard, at least in LV 2009, imported bool as char * instead of int, so I replaced the bools with ints as well. See if it works.
// Header file for use with stp.dll int InitStp(); int RunMotor1(int steps, int interval, int direction, int outputs); int StopMotor1(int outputs); int RunMotor2(int steps, int interval, int direction, int outputs); int StopMotor2(int outputs); int SetStepMode(int M1Mode, int M2Mode); int GetCurrentStatus(int *M1Active, int *M2Active, int *M1Steps, int *M2Steps, int *Inputs);
Actually bool is a C++ feature. And the standard says nothing about what size to use for that data type, so it is implementation (compiler) specific. Most compilers seem to use an 8 bit integer however. Visual C++ 4.2 used a header to define bool as int, but later version have a built in type that is implemented as 1 byte type.
This is different from BOOL, which is a Microsoft Windows API datatype and is indeed defined to be always a 32 bit value. As long as you pass a bool by value it won't really matter to much, since the compiler will pass any parameter smaller than 32 bit anyhow in a 32 bit stack address. However you have to watch out about possible sign extension then, if the caller and callee don't use the same parameter size. 0xFF seen as a signed 8 bit integer (-1) is something entirely different than the same value interpreted as 32 bit signed integer (255). When passing it by reference you need to be a bit more careful, but using a larger size in caller than what the callee expects is always safer, eventhough you need to watch out about sign extension.