LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Connecting a dll to labview

Hi,

I am trying to link a dll in labview using call function. I have never
done it before.
I have been definitely struggling with it.
I have the dll file, the header and c files and I am finding problem
with a few input parameters, how to define them.

I have everything in here and would be very thankful if some one can
have a look at the files and make the corrections.

I am sure there are lot of errors in the way I programmed this VI.

Thanks a lot,
Ajit.
0 Kudos
Message 1 of 7
(3,228 Views)
Hi,

The vi you've send seems to be working (it doesn't crash). But I think the
input id needs to be registered first (with the register function in the
dll), and closed when done (with the dispose function in the dll).

If you have an example c program using the dll, it would help...

Regards,

Wiebe.



"Ajit" wrote in message
news:50650000000800000085C00000-1075935269000@exchange.ni.com...
> Hi,
>
> I am trying to link a dll in labview using call function. I have never
> done it before.
> I have been definitely struggling with it.
> I have the dll file, the header and c files and I am finding problem
> with a few input parameters, how to define them.
>
> I have everything in here and would be very thankful if some one can
> have a look at the files
and make the corrections.
>
> I am sure there are lot of errors in the way I programmed this VI.
>
> Thanks a lot,
> Ajit.
0 Kudos
Message 2 of 7
(3,228 Views)
HI Wiebe,

I am sending a test file using this dll.
Can u test the dll and let me know how to do the testing and proceed
further.

I am sending all the files attached.

Thanks alot,
Ajit
0 Kudos
Message 3 of 7
(3,228 Views)
Ajit,

The attached VI has most functions. I cannot test it here, but the results
seem ok. You'll have to make some nice VI's from the sequence frames (,
preferably including error handling). The test program also has a loop
around it... That sould be easy enough. LCOM_NOTEXIST and LCOM_OK are not
defined in the header file, so you'll have to fiddle with that too.

Regards,



Wiebe.

"Ajit" wrote in message
news:506500000005000000395D0100-1077302006000@exchange.ni.com...
> HI Wiebe,
>
> I am sending a test file using this dll.
> Can u test the dll and let me know how to do the testing and proceed
> further.
>
> I am sending all the files attached.
>
> Thanks alot,
> Ajit



[Attachment test file.vi, see below]
0 Kudos
Message 4 of 7
(3,228 Views)
Hi Wiebe,

Thanks a lot for your response.
I shall go through the vi u sent me , study it step by step and will get back to you if I have further problems.

Thanks a lot,
Ajit
0 Kudos
Message 5 of 7
(3,228 Views)
Hi Webie,

I have small doubt.
I could clearly understand the example that u sent me.

But I need to modify the VI to change the test file.

Supose I need to do the following,

1)First /* Set the lcmaster properties - not likely to fail */. This is already done.

2)Register the slave...spawning..it is already done.

3)thirdly instead of the LCOM_MAsterGetLine function I need to use LCOM_MasterPutLine function of the dll and input the slave ID and the line " load auto".

4)Then again I need to use the same option of the dll and input the slave Id and the line "auto"

Now what happens is the third party software to which the dll belongs loads a file called auto and then solves the file when we say auto.

And then
it prints the output file in the same directory.

But there might be a problem here.
LabVIEW has to wait till the third party software solves the file and gives the output.

For that I guess we need to use a while loop saying to wait till there is some output.

And finally we need to dispose the ID as we have done already.

Can you help me in modifying the VI file that u sent me before.

I am sending the file back to u here.

Thanks a lot,
Ajit.
0 Kudos
Message 6 of 7
(3,227 Views)
Hi,

I added two API calls to LCOM_MasterPutLine. I cannot test it here, but this
is how LCOM_MasterPutLine is defined...

To detect OK, FAIL or BUSY, you'll have to experiment with the values, or
contact the third party to get those values. Adjusting the while loop should
be a matter of trying what works best, e.g. testing if it reads anything, or
waiting until it reads nothing anymore, or something else.

Regards,

Wiebe.



"Ajit" wrote in message
news:506500000005000000C65D0100-1077587809000@exchange.ni.com...
> Hi Webie,
>
> I have small doubt.
> I could clearly understand the example that u sent me.
>
> But I need to modify the VI to change the test file.
>
> Supose I need to do the following,
>

> 1)First /* Set the lcmaster properties - not likely to fail */. This
> is already done.
>
> 2)Register the slave...spawning..it is already done.
>
> 3)thirdly instead of the LCOM_MAsterGetLine function I need to use
> LCOM_MasterPutLine function of the dll and input the slave ID and the
> line " load auto".
>
> 4)Then again I need to use the same option of the dll and input the
> slave Id and the line "auto"
>
> Now what happens is the third party software to which the dll belongs
> loads a file called auto and then solves the file when we say auto.
>
> And then it prints the output file in the same directory.
>
> But there might be a problem here.
> LabVIEW has to wait till the third party software solves the file and
> gives the output.
>
> For that I guess we need to use a while loop saying to wait till there
> is some output.
>
> And finally we need to dispose the ID as we have done already.
>
> Can you help me in modifying the VI file that u sent me before.
>
> I am sending the
file back to u here.
>
> Thanks a lot,
> Ajit.



[Attachment test file.vi, see below]
0 Kudos
Message 7 of 7
(3,228 Views)