LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using a C dll!?

Hi!
I have a dll consisting of the following simple code:

int __stdcall Array_dll_test(int data1, int data2)
{
return (data1 == data2);
}

How do I set up my CLF in LabVIEW? I have tried several possibilities
but LabVIEW can't seem to find the function in the library... Please
help!

/Stefan
0 Kudos
Message 1 of 3
(4,163 Views)
Sounds like the C++ compiler is mangling the function names - try renaming
your source file with a .c extension instead of .cpp and re-compiling.
Visual C++ will not mangle the function names on a .c file.

You can use the Quick View utility in Windows to look at the function names
in your dll if you wish to verify the function names are in the dll
correctly.

Chris


Stefan Eriksson wrote in message <37A052C0.7C29266D@home.se>...
>Hi!
>I have a dll consisting of the following simple code:
>
>int __stdcall Array_dll_test(int data1, int data2)
>{
> return (data1 == data2);
>}
>
>How do I set up my CLF in LabVIEW? I have tried several possibilities
>but LabVIEW can't seem to find the function in the library... Please
>help!
>
>/Stefan
>
0 Kudos
Message 2 of 3
(4,163 Views)
Stefan Eriksson a écrit dans le message <37A052C0.7C29266D@home.se>...
>Hi!
>I have a dll consisting of the following simple code:
>
>int __stdcall Array_dll_test(int data1, int data2)
>{
> return (data1 == data2);
>}
>
>How do I set up my CLF in LabVIEW? I have tried several possibilities
>but LabVIEW can't seem to find the function in the library... Please
>help!
>
>/Stefan
>

If you want to prevent function name mangling, you can change your source
filename extension with ".c" but if you want keep ".cpp" extension you can
write:
extern "C" {
.......
}
around function prototype and around function bodies.
0 Kudos
Message 3 of 3
(4,163 Views)