From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

dll

Solved!
Go to solution

Hi, I'm aware there are plenty of threads around this topic, but there are a lot of variations and I've never used LabVIEW before, and I seem to be struggling at a very basic level, so I'm hoping someone can help me out with the very simple specific test case below to put me on the right track.

 

actually i am trying to allocate some memory   in my dll code (using malloc function) ,and pass that memory location address from dll to labview.

 in dll i placed some data in that location but in labview when i was trying to dereference the memory location i am not able to get the data what i placed.

 

for getting address i send a unsigned 64 bit integer from labview to dll function as a pointer to value  .

and in  c dll i just used pointer as argument to recieve this integer address and placed the memory location address in that interger address using pointer .  

 

 

Thank you in advance

 
0 Kudos
Message 1 of 6
(3,665 Views)
OK, what kind of data are we talking about here? There are many examples that demonstrate passing data in and out of DLLs. What makes your problem unique?

Next why a DLL? You appear to be creating this widget yourself. Are you wanting to call the code from a non-LabVIEW environment?

You do know that you can create DLLs in LabVIEW right?

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 6
(3,623 Views)

thank yo for your reply mike,

sry mike i don't know how to create DLL using labview, but here i am trying to get data from a flat panel he gave a  C dll.

it consists a function has memory location as argument ,so i am using vc++ 6.0 for creating library which creates memory and pass to dll ,and then im trying to send the location from librery to labview for dereferencing data.

 

 

 

when i created memory using malloc function and returing  that address to the labview.

in labview when i am trying to dereference that location i am getting garbage data.

 

 

0 Kudos
Message 3 of 6
(3,589 Views)
Solution
Accepted by topic author anil06

@anil06 wrote:

sry mike i don't know how to create DLL using labview, but here i am trying to get data from a flat panel he gave a  C dll.

it consists a function has memory location as argument ,so i am using vc++ 6.0 for creating library which creates memory and pass to dll ,and then im trying to send the location from librery to labview for dereferencing data.


If I've understood correctly, you have a DLL you want to call. A function in that DLL expects a pointer to allocated memory as one of its parameters. You have created an additional DLL just to allocate memory, because you have not spent enough time reading through the LabVIEW help and posts on this forum to see that LabVIEW can allocate memory and pass a pointer to it simply by initializing an array of the correct number of bytes.

 

If you post your code, and the header (.h) file for the DLL you want to call, along with any documentation for that DLL, we can provide more specific help.

0 Kudos
Message 4 of 6
(3,570 Views)

Fiirst, as VC 6.0 doesn't support 64 bit code creation, you should definitely use a 32 bit entity as pointer, or if you use LabVIEW 2009 or newer (but why then such an old and unsupported C compiler?? ) then use the pointer sized datatype.

 

But without a lot more information from you as to the DLL source code and what you have done in LabVIEW so far (attach both the VIs and C source code of what you have done so far) we only can keep poking in the dark.

 

 

Rolf Kalbermatter
My Blog
0 Kudos
Message 5 of 6
(3,563 Views)
Solution
Accepted by topic author anil06

thank you nathand.

i tried what you said by creating an array with required size passed to the dll then it works.

thanks for your help.

0 Kudos
Message 6 of 6
(3,490 Views)