From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

StepperBee+ DLL Driver Issue

Solved!
Go to solution

Hi There.
I am having trouble using the import wizard for Dll's. The problem lies with the header file that is included with my DLL. The header file only has pointers to the functions within the DLL, and not the declarations of these functions. I have also tried to use the Call Library Function Node, but seem to be stuck. I have no knowledge of C/C++ and am only using LabVIEW as a stepping stone for my final year engineering project. If anyone can help, I would really appreciate it.
I attach the dll, the .h file as well as the manual for the control board if anyone would be interested in helping me.
Many Thanks.
0 Kudos
Message 1 of 5
(4,097 Views)

[Cross-posted to LAVA]

Certified LabVIEW Architect * LabVIEW Champion
0 Kudos
Message 2 of 5
(4,091 Views)
Solution
Accepted by topic author dutchboy2704

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);

0 Kudos
Message 3 of 5
(4,086 Views)

WOW.... Straight out and it works... Thanks alot for the help nathand, I really appreciate it.

 

:):):):):):):)

0 Kudos
Message 4 of 5
(4,077 Views)

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.

Rolf Kalbermatter
My Blog
0 Kudos
Message 5 of 5
(4,043 Views)