LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how can we get a pointer of a variable in labview 6.1 ?

i have a variable and i need his adress, can you help me to have the adress.
thanks
0 Kudos
Message 1 of 8
(4,032 Views)
Are you talking about to pass data to a DLL or CIN? That's the only two places pointers become issues in LV. In straight G code, variables don't have pointers--heck they don't even have names.

What exactly is it that you are wanting to do?

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 8
(4,032 Views)
Pointers as we know them from textual languages like C are not used in G...

However if you can tell a bit more about what you are trying to do (or even better, attach some of the code as well) in your code I might be able to suggest a "LabVIEW solution"...
0 Kudos
Message 3 of 8
(4,032 Views)
hi
in fact, i want to use a dll write in C and its need a pointer to a structure.
This dll get properties about object, so it's important to have the index.
if you have an idea, thanks a lot
regards
0 Kudos
Message 4 of 8
(4,032 Views)
Hi,
if you need to use pointers to pass data to DLL you have to dopuble click on "Call library function" which you use to execute some function from DLL. The dialog will apear. Then select some parameter from pop-up list of parameters. Every kind of parameters have a property like "Pass" for numeric, "Array Format" for arrays, "String Format" for strings or "Data format" for adapt to type, which specify how to pass data to DLL. Depending on data type this property may be equal to "Value", "Pointer" or "Handle". So I think this what you want.

Be careful with calling conventions which could be equal to "stdcall(WinAPI)" or "C" depending on compilation of your DLL.

Good luck.

Oleg Chutko.
0 Kudos
Message 5 of 8
(4,032 Views)
hello
in fact, i search a module which permit to have the address of a variable and one which permit to have the value at the address.
where i can find this or which function i have to use?
thanks for your answer
regards
Philippe Raynaud
0 Kudos
Message 6 of 8
(4,032 Views)
Oleg really pointed you in the right direction. If you need more details:
1. On your diagram, right-click on empty space, goto to Advanced palette, and select Call Library Function Node.
2. Double-click on Call Library Function Node (or right-click on Call Library Function Node and select Configure). A dialog box titled Call Library Function will open.
3. In the box titled Library Name or Path, enter the path to the DLL. Note: if this DLL calls a second DLL, that second DLL must be on the search path).
4. In the box titled Function Name, enter the function name (case sensitive) or select the Function Name from the pull-down list.
5. Select the Calling Conventions (C or WINAPI) used by the DLL.
6. Specify the return type.
7. If any parameters are passe
d, click Add a Parameter After.
8. In the box titled Parameter, enter the parameter name.
9. Select the Type and Data Type of the parameter.
10. If the data is numeric, using the pull-down list titled Pass, select Value or Pointer. You'll have similar choices (labeled differently) for different data types.
11. To add another parameter, click Add a Parameter After or Add a Parameter Before.
12. If you use an array, make sure you initialize the array in LabView to the size the DLL needs. Don't re-size the array in the DLL or you may crash your program.
0 Kudos
Message 7 of 8
(4,032 Views)
Philippe,

You could do either, it just depends upon what you want to implement. A cluster in LabVIEW is very similar to a structure in C. However, if your structure has pointers to other objects, then you will have to create a wrapper function in C that has all of the values passed in from LabVIEW separately and then compile the needed structure inside of the C wrapper function itself. If your structure does not contain pointers, but it does have inlined arrays, then you can use the Array to Cluster function to create a group of items that when passed to the C function will be tread exactly as if it were an inlined array (you would have a cluster inside of another cluster in LabVIEW). If your structure does not have any inlined arrays, then doing what you
want is very easy. Make sure you have looked at the "Using External Code in LabVIEW" manual for more help. There are also a number of examples out there that will help you call into a DLL with different data types. Just search for "+call +dll +labview +data +type" at http://www.ni.com/support inside of Option 3.

Randy Hoskin
Applications Engineer
National Instruments
http://www.ni.com/ask
0 Kudos
Message 8 of 8
(4,032 Views)