LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

can i call a dll developed by labview 6.1 in Borland c++ builder?

>>special LV type definition

If you look in the NI headers you should see what standard c types they match to.

Clusters are just a structure in c and I assume that you create a new instant with NEW.


2D arrays should not be a problem.

This is just a pointer to pointer. **

I will play with Labview and Borland later and see if I have proplems.

Not today as I have weekly boring meetings.

Colin
0 Kudos
Message 11 of 14
(1,081 Views)
Hi Andrew

Seems I was wrong in stating that you should not need to any lvrt engines functions in your code.

As I will need this info myself I will plod on and solve the problems. (Hopefully)

I created lib file for lvrt.dll only as the simbles exported from the other dlls do not seem to be much use so no lib files should be needed for them.
Odd that you say that adding the lib files to Borland improved things.
If lvrt.dll need them then it only has to find them.
The odd one was lvffrt.dll as it seems to export the same functions as lvrt.dll. I don�t know what this one is for. It also contains a load of other rubbish not in lvrt.

I would expect errors from Borland if both libs are used in the same project.
Duplicate function names.

The .obj file is in coff (Microsoft) but as it only contains CIN function that we cannot use in DLL�s there is no problem there.
The labview.lib file proberly contains the function for all the dlls and the .obj.
Coff2omf failed to convert this file to OMF, It could be that this file is a static lib file containing objects that call the DLL (An old style library file) as apposed to a DLL lib file
I don�t think so as the .obj file would not be shipped externally.

Lvrt.dll exports a load of functions that are not exposed in the headed file including some to do with FPGA. (Interesting to me).

I copied a bit of code from the manual and it compiled and ran OK.

This was the simple one that created a new int32 and some simple sums.

This just proved that I was linking with the DLL OK.

>>At present I define an array of the maximum expected size at compile time
>>
I don�t understand what you are doing here.
"define" is that create.
Are you creating the array using any of the lvrt functions.
If so could you tell me the function name so I can test it.

>>I can deal with 1D numeric and string arrays, but arrays of clusters or arrays of more than 1 >>dimension only compile to a DLL with a special LV type definition - it is manipulating those arrays >>from the C end I was having problems with.

You are a ahead of me there.

Could you tesll me how you created the 1D array as I need to do that. I assume that the parameter to the Labview is (double *) a pointer
Pluss the lvre function for deleting the array.

2D Array.
From what I can gather Labview does not know what a c style 2D array is.

The type is exposed as a �c� style structure but in memory it is just an array of number.
Structures could be padded out in memory for alignment, hence the 1 byte alignment used.

The defined structure only allows you to step through the array In your code easily.
Without it you would have to use pointer of different types �int32 * double*� and so on.
As I understand it, in memory the array consist of 4 byte to start with.
2 byte for the ROW number then 2 bytes for COL number. �could be the other way round�

The data follows this one row at a time.

Number-of-rows number-of-Col then Row0 Row 1 Row 2

So using the Structure to do this should be easy.
After creating the memory.

LabviewStructure->eliments[0] = number of row

LabviewStructure->eliments[1] number of Col

Could be other way round, forgot.

I will not use nested for statement here as it can confuse things just like some of the sample I have seen.

Im cant wright for loop code here in HTML


LabviewStructure->data[0 to col];
That�s the first row.


LabviewStructure->data[col to col*2];
Secont row

That�s the way I understand it for arrays.
I don�t see clusters being that different but things could get complicated with embedded array and clusters.

I have found the function for creating the memory but not the one deleting or resizing.

I found this snippet.



#include �float.h�
Int main()
{
__Control87(MCW_MW, MCW_MW)

I put this at the start of the program �WinMain()�
At the beginning of the try block.

I understand that this stops some exception coursed by NIDA doing something odd.


Might help. But you don�t say you are using NIDAQ.

Colin
0 Kudos
Message 12 of 14
(1,081 Views)
Hi Colin,

I can't remember which was the extra LVRTE DLL I created a lib file for - I think it began with an E!

The C functions for manipulating arrays can be found in an NI manual if you haven't already seen that.

When I say define array size I mean edit the header file of the MyLV_DLL which has the type defs for the array structs (only applicable for LV style arrays).

I agree that manipulating the arrays should be easy - it's just that I never managed to do it. I included the code to read an element and resize the array. With only one of the
se in the code the code would compile and start (not calling the array function); with both the code would compile but would not even get as far the form initialise function let alone the array functions without generating a Visual C++ error(!). I can't remember the error but Google had nothing on it.

To be honest this was all a few months ago and my colleague who dealt with the Borland stuff has moved on which means I can only be of limited help working from memory. Good luck with getting things working. If you do manage to get 2D arrays working I'd be interested in the Borland code snippet for resizing the array.

Cheers,

Andrew.

Andrew.
0 Kudos
Message 13 of 14
(1,081 Views)
I will plod on and see how far I get.


>>but would not even get as far the form initialise >>function

I had the same problem untill I added the lvrt.dll to the project path.
I had assumed that as it was a runtime DLL Borland would find it.
Odd that, as normaly Borland would tell me which DLL it can not find.

Thanks
Colin
0 Kudos
Message 14 of 14
(1,081 Views)