LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW Error in DLL with pointor

Hi,
 
Sorry for my very very bad english....
 
I developped a DLL in Visual C++. In this DLL, I call functions with pointors like parameters. The DLL works very well under Visual but when I call it under LabVIEW 7.1, LabVIEW gives an error when a pointor is read or modify.
Can someone help me? Thanks
 
 
Bonjour,
 
J'ai développé une DLL sous Visual C++. Dans cette DLL, j'utilise des sous-fonctions en leur passant des pointeurs. La DLL fonctionne très bien sous VIsual C++ mais sous LabVIEW 7.1, LabVIEW retourne une erreur (l'exécution s'arrête) quand la DLL veut modifier ou lire un de ces paramètres.
Avez-vous déjà rencontré ce problème et avez-vous réussi à le résoudre? Merci
 
 
0 Kudos
Message 1 of 29
(4,283 Views)
I'm not sure how you are using the pointers in LabVIEW, but LabVIEW and the dll won't be sharing memory space so a pointer in the dll will not be referencing the memory in LabVIEW. There have been a few threads in last couple of months in this forum regarding this
.
P.M.
Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 2 of 29
(4,245 Views)

Hi Celgi,

      Are you saying:

      Inside your DLL, you call a function with some formal parameter(s), and, one (or more) of those parameters is a pointer(?)

      Or, are you saying that one (or more) of those parameters are pointer Variables (pointers to pointers)?

      Perhaps a simple prototype (of function) would help illuminate - though, I've no idea where this is going. 🙂

Regards

When they give imbeciles handicap-parking, I won't have so far to walk!
0 Kudos
Message 3 of 29
(4,241 Views)

Thanks for your answer.

In fact, the pointer used only in the DLL's function. LabVIEW 7.1 call one DLL's function "Point" with an entry "Mesure IN" and two exit "Error code" and "Mesure OUT".

This function call an other function "wait_point" with a pointer on "Mesure": the value "Mesure IN" is used to find its new value. This new value becomes "Mesure OUT". The function "wait_point" return an error code too.

LabVIEW stop when the function "wait_point" try to modify ou read the value of the pointer.

0 Kudos
Message 4 of 29
(4,239 Views)
Hi Celgi,
      I'm no expert, but your DLL seems very simple.
      I'd try:
            in the Call Library Function prototype, set the "PASS" property of your "MEAS"urement to "Pointer to Value".  In LabVIEW, wire the numeric to the Call Library Function, but in the DLL, you will have a pointer to the value.  Be tres, tres, tres careful to use the correct "Data Type" for "MEAS", and, don't try to modify the address of "MEAS" inside your DLL!  You _should_ be able to change the value of MEAS.
 
Regards
When they give imbeciles handicap-parking, I won't have so far to walk!
0 Kudos
Message 5 of 29
(4,234 Views)

Thanks Dynamik and LV_Pro.

I don't really understand the last answer but I'll search if I changed the address of a parameter in my DLL. Thanks Smiley Happy

0 Kudos
Message 6 of 29
(4,229 Views)

Hi Celgi,

      Do you use "Call Library Function" to interface with your DLL?

Here's a pic re: "PASS" and "Data Type" (hope it helps)

 

When they give imbeciles handicap-parking, I won't have so far to walk!
0 Kudos
Message 7 of 29
(4,225 Views)
Ok Dynamik, I understand your answer. I knew these properties for "Call Library Function". The pointers aren't in LabVIEW but in the DLL: I pass under LabVIEW an parameter with "Type" adapt to the type in LabVIEW (I have a French LabVIEW and it says "Adapter au type"). This parameter is a cluster of clusters. In the DLL, it becomes a structure of structure with the same order as the cluster.
Then, I pass the address of this structure in an other function of the DLL for modify it.
 
Perhaps, it isn't a pointer's problem but an problem of cluster transfert. What do you think?
 
0 Kudos
Message 8 of 29
(4,210 Views)

HOLY S**t - I mean, Sacre Blue!

This JPG makes me want to work on problems of my own.

Re: Cluster Transfer - Yes, perhaps it's a data-type SIZE or Cluster-order issue - so many type-defs!

I would print-out the .h files for the C structs, and compare them, element by element, byte for byte, with the LabVIEW Clusters.  And, make sure the LabVIEW CLUSTER-ORDER matches the Struct! 

Of course, you truely might have some strange pointer problem...

Bon Chance!

When they give imbeciles handicap-parking, I won't have so far to walk!
0 Kudos
Message 9 of 29
(4,192 Views)
Take a look at here. I'm sure you'll find your answer if you read it carefully and patiently!
0 Kudos
Message 10 of 29
(4,180 Views)