LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

2009 DLL issues

Solved!
Go to solution

I am trying to import a dll into 2009,

 

I've used Tools, Import, hsared library (.dll), I then don't get a choice on the next window "specify create or update mode" is selected. On the next window i have put the path to the dll and header in. There is them another windo with "include paths" and "preprocessor definitions" on, if I don't select anything here and hit next then the dll funtions have an x next to them on the following window.

 

I've attached the manual which includes some other programming tips but for VB and C++.

 

 

I hope someone can help.

 

 

regards

 

Stephen

 

0 Kudos
Message 1 of 7
(3,304 Views)

Since you don't include the mt.h file in your post it is hard to say anything specific, but I guess this header file includes other header files such a s Windows SDK files.

 

Another possibility is that it only defines the function pointer datatypes but doesn't declare the actual function prototypes at all. The shared library import wizard can not guess that the function pointer datatypes would correspond to a similarily named exported function and not seeing an actual function prototype that matches any exported function name is has to throw its hands into the air and simply give up.

 

But seeing that the DLL only exports three very simple functions, creating the according VIs yourself using the Call Library Node should be an easy exercise, if you at least know a minimum amount about C datatypes.

Message Edited by rolfk on 03-02-2010 12:17 AM
Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 7
(3,284 Views)

Rolf,

 

Here's the header file, does that help?

 

Stephen

0 Kudos
Message 3 of 7
(3,261 Views)
Solution
Accepted by topic author theboybatis

// Header file for use with mtb.dll                                  
                                                                     
typedef bool    (*Type_InitMotoBee)();                                 
typedef bool    (*Type_SetMotors)(int on1, int speed1, int on2, int speed2, int on3, int speed3, int on4, int speed4);

typedef void    (*Type_Digital_IO)(int *inputs, int outputs);        

 

This file has indeed two problems. The first is the use of the bool datatype that is only a C++ datatype but not a standard C datatype. I don't think the import Wizard supports that but the solution would be do add an according define such as #define bool char to the defines part of the import wizard.

 

The bigger problem is that it only defines function pointer types but no function prototypes.

 

You can fix that by adding following lines at the end:

 

bool    InitMotoBee(void);                                 
bool    SetMotors(int on1, int speed1, int on2, int speed2, int on3, int speed3, int on4, int speed4);

void    Digital_IO(int *inputs, int outputs);         

 

 

With this and the according bool define in the import wizard settings it should work

Rolf Kalbermatter
My Blog
0 Kudos
Message 4 of 7
(3,255 Views)

Thanks Rolf,

 

That worked really well.

 

Regards

 

Stephen

0 Kudos
Message 5 of 7
(3,201 Views)

Hi. i am new to  Labview and have been learning how to use it for the past 3 months. i have maanged to build a design layout and now want to focus on making the functions work. i have 5 sildes which i want to use to control 5 motors. i have a K8055 usb interface board and wanted help on how to use a slide to move the motor. any help is greatly appreciated

 

Joe

0 Kudos
Message 6 of 7
(2,875 Views)

Where is the connection to the original topic? Please start a new thread about this and be prepared to provide a lot more information. This one is a bit like saying I have engine XYZ and want to build a car. Please help me with that.

Rolf Kalbermatter
My Blog
0 Kudos
Message 7 of 7
(2,866 Views)