取消
显示结果 
搜索替代 
您的意思是: 

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 项奖励
1 条消息(共 13 条)
4,581 次查看
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 项奖励
2 条消息(共 13 条)
4,565 次查看
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 项奖励
3 条消息(共 13 条)
4,560 次查看
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 项奖励
4 条消息(共 13 条)
4,553 次查看
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 项奖励
5 条消息(共 13 条)
4,549 次查看
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 项奖励
6 条消息(共 13 条)
4,544 次查看
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... 😉
--------------------------------------------------------------------
7 条消息(共 13 条)
4,542 次查看
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 项奖励
8 条消息(共 13 条)
4,538 次查看
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... 😉
--------------------------------------------------------------------
9 条消息(共 13 条)
4,534 次查看
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!"
10 条消息(共 13 条)
4,524 次查看