LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Generating DLL with LabVIEW - A basic question

Hi everybody !

I'm trying to generate a simple DLL with LV. I have read as much as I could on the subject, prepared a small test vi (calculate x*x), built the corresponding dll, inserted and configured the ddl into another vi... Every thing seems to be fine, except that the ddl returns 0 whatever I'm doing.
I'm obviously missing something here, and I would be very gratefull if somebody could guide me out of this stupid corner.

CC
Chilly Charly    (aka CC)
0 Kudos
Message 1 of 13
(4,080 Views)
hello CC,

do you use the lvanlys.dll? if so, take a look at this

http://forums.ni.com/ni/board/message?board.id=170&message.id=117311#M117311



best regards
chris
Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
0 Kudos
Message 2 of 13
(4,064 Views)
Thanks for the reply.
My problem is much more basic. I'm just trying to understand how to retrieve the result of a simple calculation. My test vi just calculate x*x (Dble) from an x input (dble). How can I get the squared value as output of the DLL ? I tried a number of desperate combinations, but I only get zero (or LV crashes). I feel terribly dumb...

CC
Chilly Charly    (aka CC)
0 Kudos
Message 3 of 13
(4,059 Views)
Hello again,

sorry, i got you wrong. maybe that helps a bit:

First of all:
- connect all controls/indicators you want to import/export to/from your dll to the connector of your vi
- Open the dll - Buildfile, go to the "source files" tab, select "Add exported VI" and add the VI from which you want to create a function in your dll
- Click "Define VI prototype" to edit the exported functions
- In the "parameter" - list add all needed inputs/outputs of your dll and do the required settings (in most cases you don't need to do any changes)
- select a calling convention (lets say "C Calling convention")

To call the dll:
- browse the dll and select the exported function you want to execute (in most cases LV recognizes the settings of the exported VIs)
- Select the correct calling convention ("C Calling")

thats it!

as a starting point i added an example in LV 7.1.

best regards
Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
0 Kudos
Message 4 of 13
(4,052 Views)
Hi CC

I just tested it and also had problems, but just if I defined LV calling-conventions. After selecting C calling convention it worked.

Attached is a simple example (source-vi for dll, dll, test-vi, bld-file).

Hope it helps.

Thomas
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 5 of 13
(4,048 Views)
Hi Chrisger & Becktho !
Thanks for your replies.
Unfortunately I'm still stuck.
First thing is that I followed already exactly the path develepped by Chrisger. I also tried changing the calling convention as suggestedc by Becktho. No success.
Second thing is that the ddl provided by Chrisger works perfectly (sorry Becktho, you just forgot the attachment...). At least that's something that shows I'm not entirely stupid, since I'm able to use a DDL compiled by someone else ! 🙂
So, this seems to be a problem related to the way I am generating the DLL. Just in case, I have attached here the files I'm using (the source, the .bld file, and the generated DLL. Could you give them a look/trial ?

CC
Chilly Charly    (aka CC)
0 Kudos
Message 6 of 13
(4,043 Views)
Hi CC

Sorry - just to complete my reply ;).

Could you post yours in LV 7.0?

Thomas
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
Message 7 of 13
(4,041 Views)
Now, this starts to be interesting :

in LV 7.1, nothing new : the DLL I build returns 0, whatever I'm doing.
in LV 7.0, I can successfully build a working DLL, which can be used either in LV 7.0 or LV 7.1. However, when configuring the DLL in LV 7.0, I have to define all the inputs by hand since the DLL appears as void Xsquare(void) !

So, the problem is specific, either to LV 7.1, or to my personnal configuration. Thanks to Thomas, who gave me the idea to test the problem with LV 7.0.

I'm still stuck because I don't imagine going back to LV 7.0... 😞 but I feel a bit better : I'm not fully stupid... my machine is ! 😉

Could somebody make a test with LV 7.1, urgently please !
Any advice will be welcomed !

CC
Chilly Charly    (aka CC)
0 Kudos
Message 8 of 13
(4,037 Views)
Hey CC

Just to cheer you up - the great master of THE LIST can't be stupid ;).

Thomas
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
Message 9 of 13
(4,033 Views)
hello CC,

i ran the DLL from your zip under LV 7.1, the function returned 0. then i just rebuild the dll using your buildfile and it worked perfectly well. seems wicked to me!

best regards
chris
Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
Message 10 of 13
(4,023 Views)