Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation


About jbone

  • Rank

Profile Information

  • Gender

LabVIEW Information

  • Version
    LabVIEW 2010
  • Since
  1. Sorry, but I do not understand if you mean that any other option inside the Adapt to Type is valid or if none of them will work. Would it be possible to get an example on how to pass a variant to a Call Library Function Node (how to configure the parameter options) and how to use the Variant in the C code. I have found the LvVariant class defined in extcode.h but since you says there is no documentation, I do not know how to use it :$ Thank you very much.
  2. Hi, I am working in a DLL to create a Labview component that runs some C code. I was using the Call Library Function, and I see it works to write external functions that get and set Labview data in/from the C code. But now, I would like to make it work with Variants, since I want to allow to wire any kind of data into my CLF Node. I have been using the Adapt to Type - Interface to Data option to be able to introspect the LabVIEW Data from my C code and get or set its value. I have been told that Variants are structured very similar to any other LabVIEW Type, so I should be able to use the Interface to Data option as well (with some minor changes in the code and maybe some casts). But the truth is that I cannot even try it since when I connect a Variant to the CLF Node, LabVIEW tells me: I guess this means that it is not going to be as easy as expected, probably having to do some tricks, workarounds, etc. but right now I do not have any idea on what to try or where to start with. I have been trying to look in the documentation, help and posts anything useful but I did not find anything. So, any help will be greatly appreciated. Thank you very much.
  3. Hi, I am working in the Error Handling too I would be very interested in know how to do it the way you explain. Because I could not find anything that explains me how to implement the Error Handling and Checking for a DLL that gets called from a CLFN. Actually, I would be very happy just if I could associate an error number and message to the "error in" input and "error out" output that the CLFN shows if you select the Default level of Error checking. Thanks.
  4. Wooow!!! Very long and complete explanations. Thank you very much Ned and Rolf. It is very clear now.
  5. Thanks a lot! It completely works now... What I do not get is why, if it is necessary to use LabVIEW memory manager functions, I found the examples in Calling C/C++ DLLs Containing Simple and Complex Datatypes from LabVIEW using malloc, realloc, etc. Could anyone please clarify?
  6. Ok, If I try to allocate the memory for the string inside the cluster, as shown here: _declspec (dllexport) long fillCluster(char* struct_ptr) { int j; char* auxS; char sh[]= "Hello, it works!"; long* size; // The cluster stores a handle, that is a pointer to a pointer to the string *(*(char***)struct_ptr) = (char*) malloc ( sizeof(long) + (sizeof(char)*strlen(sh)) ); auxS = *(*(char***)ptr); size = (long *)auxS; // Write the size *size = strlen(sh); size += 1; auxS = (char*) size; for(j=0;j<strlen(sh);j++){ auxS[j]=sh[j]; } return 0;} Then, It runs correctly, I do not get any error while saving or running... but, after closing the VI and the project, when I try to close LabVIEW it gets blocked and will never close (I have to kill it). Thanks again.
  7. Hi, Here is my new problem: I am passing a cluster to a DLL function, in this DLL function I want to fill the data of the cluster. So, it works perfectly when I do it with simple elements, but when the cluster has strings or arrays inside, I fill it with the structure explained in How LabVIEW Stores Data in Memory. _declspec (dllexport) long fillCluster(char* struct_ptr) { int j; char* auxS; char sh[]= "Hello, it works!"; // The cluster stores a handle, that is a pointer to a pointer to the string auxS = *(*(char***)struct_ptr); // Write the size *auxS = strlen(sh); auxS += sizeof(long); for(j=0;j<strlen(sh);j++){ auxS[j]=sh[j]; } return 0;} And I can see in my VI that the string gets filled correctly. But then, when I try to save the VI, I get this error: Fatal Internal Error: "fsane.cpp", line 442 LabVIEW version 10.0f2 It seems than some object is making the sanity check fail... so probably it is because I am not filling the cluster object correctly and it gets corrupted. Do I have to allocate the memory for the cluster? for the string inside the clusert? How? Can anyone show me how to fill a cluster that is passed to a DLL function as a parameter (pointer to the cluster). Any sample code or example will be very appreciated. Thank you very much.
  8. Ok, I really like that option, because it is the one I started to implement. Thanks very much for the explanation. This part I do not get it... could you, please, explain it a bit deeper or give me some example on how to do this. Or just tell me a good place to read about. Finally, does the Instance Data Pointer anything to do with this purposes? What is it used for? Thank you very much.
  9. Thanks for the info... that explains exactly what I meant to say: in CINs you could have some data associated to each individual instance and I do not see how to do that with CFL and DLLs. But let me explain my case: I want to make my own LV component that calls some C function that uses an external API. So the first time my function is called, it creates and defines some API's variables and objects and store them. So the future callings of my function do not need to define and create them again. The main problem is that this variables and objects must be different for any instance. I mean: if I have more than one Call Library Function components, calling to my function, running at the same time, I need them to create their own API's variables and objects, instead of sharing them. So I need to be able to access or allocate some space memory for each different instance of the CLF component that calls to my function. How can I do this with Call Library Function? How can I do it with any other possibility? Thank you very much.
  10. When I said CLB component, actually I meant CLF (Calling Library Function). And another question... I have read about the possibility of using CINs, but... since they are not supported in LV2010, is there any equivalent method or way of doing what you were able to do with them?
  11. Hi, I want to create a Labview component that runs some C code. I have been trying with the Call Library Function, and I see it works to write external functions that get and return Labview data. But now, I need to store some internal data in the DLL. And, in case I have more than one CLB component calling to the same functions, the data they are going to use should related to the component that is calling the function. So, does anybody know how can I do it? I have seen there is something called InstanceDataPtr, but what does it contain? how does it work? Can I use it to identify one LV component from the others? I have been trying to find some example using this parameter, but I didn't found any. Thank you very much.
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.