Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by JKSH

  1. Jim does not come to LAVAG often (e.g. see https://lavag.org/topic/21017-where-are-openg-product-pages-for-packages/?do=findComment&comment=129287 ) I'd imagine you'd get a lot more interest if you post at the JKI forums Nested malleables + VIPC is not a combo that I use
  2. LabVIEW NXG uses UTF-8 for all text strings. I think classic LabVIEW (version 20xx) will unlikely ever get full Unicode support.
  3. Oops, I just realized: We can't use strcpy() because that would also try to copy the terminating null byte. Use memcpy() instead. (Sorry, my C is rusty)
  4. You're welcome Yes. The string bytes must be placed in the memory space immediately after the 4-byte header: (source: http://zone.ni.com/reference/en-XX/help/371361R-01/lvconcepts/how_labview_stores_data_in_memory/) Here's another illustration: A 5-char C string takes 6 bytes of contiguous memory, ending with a null byte: ['H', 'e', 'l', 'l', 'o', 0x00] A 5-char LabVIEW string takes 9 bytes of contiguous memory, starting with a 4-byte integer: [0x05, 0x00, 0x00, 0x00, 'H', 'e', 'l', 'l', 'o'] The LStrHandle cannot hold a pointer to a char array that is held elsewhere.
  5. 1) LabVIEW manages the memory of the string itself. You must allocate the memory to hold your full string plus a 4-byte header, then copy all of your string data from the DLL memory into LabVIEW memory: LStrHandle cString2LVString(const char *myCString) { const int headerSize = 4; const int stringSize = strlen(myCString); // Allocate memory for the LV string LStrhandle h = (LStrHandle)DSNewHandle(headerSize + stringSize); // Write the LV string header (*h)->cnt = stringSize; // Copy the data into the LV string memcpy( (*h)->str, myCString, stringSize ); return h; } 2) Assuming that you initialized an empty array in LabVIEW and passed the handle into your Call Library Function Node for iir_get_serial_numbers(), typedef struct { int32 len; LStrHandle str[]; } **LStrArrayHandle; int iir_get_serial_numbers(LStrArrayHandle arr) { LStrHandle buffer[1024]; // Make sure this is big enough for all cases, or use // a dynamically-resizing array like a C++ std::vector. int n = 0; while(s_deviceInfo -> next) { buffer[n] = cString2LVString(s_deviceInfo->serial_number); ++n; } // NOTE: At this point, n equals the number of devices // Resize the LabVIEW array const int headerSize = 4; const int arraySize = n*sizeof(LStrHandle); DSSetHandleSize(arr, headerSize+arraySize); // Write the array header (*arr)->len = n; // Copy the string handles into the array for (int i = 0; i < n; ++i) { (*arr)->str[i] = buffer[i]; } return 0; } 3) Yes you can. NOTE: The variable names are different, but from the LabVIEW Manager's point of view an array handle is basically the same thing as a string handle (in Classic LabVIEW, a string is an array of bytes). Allocation, resizing, and data copying techniques are the same for both types of handles. See http://zone.ni.com/reference/en-XX/help/371361R-01/lvconcepts/how_labview_stores_data_in_memory/
  6. You are calling Open VI Reference using a path that points to your hard drive (D:\DEBUG\debug\vi_01.vi). That VI is not inside your executable. It is possible to make this work, but your executable will break if you move the VI on your hard drive. It is safer to open a strictly-typed Static VI Reference. This loads a copy of Vi_01.vi is stored inside the executable itself: For more info, see https://forums.ni.com/t5/LabVIEW/Static-VI-Reference/td-p/3334006 http://zone.ni.com/reference/en-XX/help/372614J-01/glang/static_vi_ref/
  7. Wrapping the queries in a transaction ("BEGIN TRANSACTION" + "END TRANSACTION") could speed things up a lot for 250000 rows
  8. Files that don't have revisions don't need to be commited into the repository itself. GitHub has a nice feature called GitHub Releases which lets you host "release files" -- it's designed for installers/packages/binaries, but you're free to store other files there too. Each Release is linked to a tag/commit in your Git repo so you know which version of your code was used to generate the installer. Here's an example of some releases from an NI repo: https://github.com/ni/niveristand-scan-engine-ethercat-custom-device/releases/ BitBucket has a lightweight variant of this called BitBucket Downloads (the link is somewhat tangential, but it's the best I could find). I like GitHub's release file hosting more than BitBucket's, but I like BitBucket's issue tracker more than GitHub's.
  9. How about creating the initial handle in LabVIEW (e.g. an empty string), passing it into the DLL as a handle, then calling DSSetHandleSize()?
  10. I can't commit to direct collaboration, but I'm happy to share my thoughts, experiences, and code from a similar project. https://www.tensorflow.org/api_docs/ comes with a warning: This means new versions can break backwards compatibility which would be a pain for a non-Python based wrapper/binding project. This is probably a reason why NI might not stick to the latest and greatest version of TensorFlow. I can see 2 possible approaches: Wrap the TensorFlow Python API, and integrate into LabVIEW using the Python Node. Flatten the Tensor C++ API into a C API, wrap the C API, and integrate into LabVIEW using the Call Library Function Node. #1 guarantees that the wrapper won't be broken by a TensorFlow update, but restricts the wrapper to Windows and LabVIEW >= 2018 only. I also don't have experience with the Python Node and don't know what limitations might exist. #2 allows the wrapper to be used on Linux RT and on older versions of LabVIEW, but there's always a risk of compatibility breaks between TensorFlow versions. Also, given the large number of classes and functions (see https://www.tensorflow.org/api_docs/cc ), it might make sense to write a code generator (like VI scripting) that produces the actual wrapper code, instead of writing the wrapper by hand. I've written a code generator to (partially) wrap the C++ API of the Qt toolkit (see https://github.com/JKSH/LQ-CodeGen ). This generator makes many assumptions based on Qt's features and coding conventions so it's not usable for generic C++ libraries, but its source code might provide some ideas and hints. The final wrapper library is at https://github.com/JKSH/LQ-Bindings
  11. You can create a GitHub-hosted website for an organization: https://pages.github.com/
  12. A poor man's way of doing that is to prefix all of the repository names with "OpenG". Users can then use the "search" feature within the Organization to find all repos related to OpenG. For example, https://github.com/ni?q=niveristand vs. https://github.com/ni There's also GitHub Topics, although it crosses organization boundaries: https://help.github.com/en/articles/classifying-your-repository-with-topics e.g. https://github.com/search?q=topic%3Averistand+org%3Ani
  13. https://sourceforge.net/projects/opengtoolkit/ @Rolf Kalbermatter has access.
  14. I found a post with the exact same error codes: https://forums.ni.com/t5/SystemLink/Package-deployment-failed-through-SystemLink/td-p/3839425 (Google had exactly 1 hit on ni.com) JoshuaP suggests installing ni-certificates first. (His solution is for SystemLink rather than NIPM, so I'm not sure how applicable it is to your case)
  15. The Humble Monthly is the ongoing subscription. The Humble Book Bundle (and other "Bundles") are once-off payments where you decide how much to pay.
  16. I can't find any announcement that that NI SoftMotion, CompactRIO, or the NI 9503 will be discontinued. Where did you hear that?
  17. Oops, sorry... I didn't notice CL_RenderingDATA. This means the union is 64 bytes long. Try using a cluster of 16 SGLs, and only read the first 3 values. Or, try changing the parameter configuration: Type: Array Data type: 4-byte Single Dimensions: 1 Array format: Array Data Pointer Minimum Size: 16
  18. So here are more details about the other parts of the function: https://stackoverflow.com/questions/38632316/typeloadexception-using-dllimport ER_CODE: I32 KMAPI: stdcall DEVICE_HANDLE: Pointer CL_COLORSPACE: Enum (size is not well-defined in C, but it's usually 32-bit) Your CLFN must have Calling Convention = "stdcall (WINAPI)" and have 4 parameters: Name Type Data Type/Format return type Numeric Signed 32-bit Integer hDevice Numeric Signed/Unsigned Pointer-sized Integer (pass by Value) Type Numeric Signed/Unsigned 32-bit Integer (pass by Value) pColor Adapt to Type Handles by Value If you only want to read Evxy from the function, you can pretend that the parameter type is CL_EvxyDATA* instead of CL_MEASDATA*. This works because is a CL_MEASDATA union and CL_EvxyDATA is one of the structs it can store. Make a Type Definition: A Cluster that contains 3 SGL numbers, and use this cluster to to tell the CLFN how to interpret the data.
  19. These are purely stylistic issues. I'd personally prefer Boolean and subVI, but I'll follow the community guidelines (when they are produced). This one has ramifications for the ease of understanding of an article (especially for newcomers). I'm not sure what's best here. Perhaps we can let NI spearhead the effort to "normalize" the use of "G". We can stick to "LabVIEW" for now since it's more common, but switch over to "G" later when NI's efforts bear fruit. I'm with Rolf; same-page is much more useful in the forseeable future.
  20. This thread is about literature, not code. It's a question of finding a balance between practicality and professionalism. Side A can reasonably accuse Side B of being a Grammar Nazi while Side B can reasonably accuse Side A of being sloppy. My response would be "be consistent within a project". Feel free to have different conventions across different projects. So for the Wiki, we should at least be consistent within a single article or group of closely-related articles. Some might even argue that the whole Wiki is a single project. No, as long as you don't care when people write "LabView".
  21. If was written successfully, then it can be read too. The key is to find out what name was stored in the TDMS file. If you call TDMS Get Properties.vi without wiring the "property name" and "data type" input, you're meant to get an array of all available properties in the "property names" output. I presume you meant TDMS Get Properties.vi? If so, then that's very weird. My next guess would be you're opening different files in LabVIEW vs. DIAdem. Try calling TDMS Get Properties.vi without the name inputs immediately after you write the custom property.
  22. What level of properties did you write? File, Group, or Channel? What level of properties are you trying to read? File, Group, or Channel?
  23. Your cDAQ should have a few GB at least, right? Anyway, I prefer to build the VIs in my Windows PC, and then use Application Builder to convert the VIs into an application + installer. After that, I transfer the installer into the cDAQ. (I also uninstall the LabVIEW development environment from the cDAQ -- this will free up another 1.5 GB)
  24. Hello, For years I've used Split String.vi and Join String.vi from the Hiddem Gems palette. I see that LV 2019 has the new "Delimited String to 1D String Array.vi" and "1D String Array to Delimited String.vi". I haven't installed LV 2019 yet; does anyone know whether the new official VIs are just wrappers for the Hidden Gems VIs? Is it OK to keep using the Hidden Gems VIs going forward?
  • Create New...

Important Information

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