I want to import a DLL to Labview and create VIs from my functions. For simple functions with common data types, it works well. My problem is when the function has a struct data type.

I followed this tutorial to import.

My DLL files:


#ifndef TEST_H_
#define TEST_H_

typedef struct
    int r_sum;
    int r_minus;
    int r_multiply;
    float r_divide;

int sum(int a, int b);
int minus(int a, int b);
int multiply(int a, int b);
float divide(int a, int b);
CALC_t calc_all(int a, int b);

#endif /* TEST_H_ */


#include "test.h"

int sum(int a, int b)
    return a+b;

int minus(int a, int b)
    return a-b;

int multiply(int a, int b)
    return a*b;

float divide(int a, int b)
    return (float)a/b;

CALC_t calc_all(int a, int b)
    CALC_t result;
    result.r_sum = sum(a, b);
    result.r_minus = minus(a, b);
    result.r_multiply = multiply(a, b);
    result.r_divide = divide(a, b);
    return result;

When I import the DLL, the VIs of the functions sum, minus, multiply and divide are successfully created and works well. The function calc_all isn't created and the Labview shows this warning message:

Cannot create VI

The following VI cannot be created. This might indicate that the associated function contains
parameters of a data type that cannot be converted directly. To work around this issue, you can 
create a custom control or typedef control to represent a complex structure or multidimensional 
array, then re-run the Import Shared Library wizard and select Update VIs from a shared library.
Using the same shared library, step through the wizard again. On the Configure VIs and Controls 
page, assign the custom control or typedef to the associated parameter(s). Complex structures 
include nested structures, structures containing arrays, arrays of strings, and multidimensional 


I tried to change on the Configure VIs and Controls page, assign the custom control, cluster and another data type but without success.

I used cygwin32 to compile the library with Eclipse IDE. My Labview is Labview 2021 32bits.

  • \$\begingroup\$ This is probably better suited to Stack Overflow. \$\endgroup\$
    – Null
    Sep 29, 2021 at 14:32


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.