Jump to content

Rolf Kalbermatter

Members
  • Posts

    3,837
  • Joined

  • Last visited

  • Days Won

    259

Everything posted by Rolf Kalbermatter

  1. One thing that hits LabVIEW saves and loads quite badly are certain Virus Scanners. They seem to want to intercept every single LabVIEW disk access and that can mount up to really long delays and totally maxed out cores. Some virus scanners are worse than others but all of them have some influence. Another reason for long delays when trying to open a file can be network paths installed in the explorer workspace (either mapped to a disk drive letter or simply as network path). If some of these paths are not currently available Windows tends to run into timeout delays for various file access routines including opening the file dialog box. For some reason Windows seems to enumerate the whole desktop workspace repeatedly on such actions and queries all those paths and if the network server that these paths connect to is slow to respond or not available, that enumeration can really take several seconds and more.
  2. Not sure what you try to say here. TCHAR is a Microsoft definition that will either use 16 bit UTF characters when UNICODE is defined or 8 bit ASCII characters when UNICODE is not defined. The only way to find out is by checking the project file for the test application. Depending on the Visual C version you can either set a specific property in the compiler settings that the code should be compiled as Unicode or not or you can also define the UNICODE explicitly yourself although that is likely to cause some problems at some point as other compiler options might depend some other things on the specific setting itself and not refer to a project define of UNICODE itself. The problem is not about what Visual C uses by default for it's main function but how the test application (and ultimately the DLL) was compiled. It is also not entirely clear that _Initialize() uses char* for the parameter. The underscore in front of the function could just as well mean that the definition in the first post is not really taken from the header file but rather deducted from the Call Library Node dialog. However I did a quick check of the name mangling shown in that picture and from that it seems to be indeed char* so not sure what else could be the issue here.
  3. There is no fixed rule. Generally it is better to open it once outside the loop and then release it at the end. However some components are not written in a way that allows that without having the previous execution influence the next one, and then it is sometimes necessary to open and close the object every iteration.
  4. Fake Exec State might not do what the OP needs in this respect, it anyhow would miss the event handling for the popup menu to do anything when the user selects the menu. And Fake Exec State is known to do some very nasty things to a VI that many LabVIEW functions do not expect at all and will simply drip over with a crash or worse.
  5. FlexLM is the engine used for the LabVIEW licensing scheme, both for simple licenses as well as volume licensing. But I think your very frequent hit of the registry for a borrowed license check might be a bit excessive and caused by some kind of misconfiguration in the NI License Manager.
  6. And I have never seen a programming environment that resembles LabVIEW in just about anything , and I don't really consider this a bad thing. I'm usually more concerned about starting up an application that seems to do nothing for a very long time, only to find out that there will be eventually 10 copies of it started up after minutes of inactivity. Not to speak about the thoughts of if it may install all kinds of nasty things in the background while seemingly doing nothing. Compared to that a search dialog is a minor inconvenience and easily worked around with your own splash screen.
  7. There is another spam post in the blogs. I would, but the Report Entry button on blog posts shows a privilege error when I press it. So there seems no way to report a blog post directly.
  8. That window shows automatically after a certain amount of time when the VI hierarchy hasn't been fully loaded yet. It has done so since very early versions of LabVIEW and there is no INI file setting that I'm aware of to disable it. Most likely something has caused the load to take longer when the program was ported to a newer LabVIEW version by Mikael. The way to avoid it is to create your own splash screen with very small hierarchy that then loads the actual Main VI dynamically using VI Server Run method. That way there is a quick screen that avoids the LabVIEW search dialog and then you can take as much time for loading your actual main hierarchy as you want.
  9. That's currently mostly true due to most Win64 machines still using not more than 4GB memory per process normally. But going to rely on this will surely go and bite you in a few years when your 100GB machine is starting to crunch on 5000* 2500 pixel images in 32 bit color mode. Microsoft didn't define a handle to be pointer sized for no reasons. Internally most handles are pointers.
  10. I thought MBCS coding has exactly the attribute of not specifically using a fixed size code size for the different character elements. So I somehow doubt your claim that Asian localized LabVIEW would show double the number of bytes in String Length than it has characters. It would be most likely around double if the text represents the local asian characters but likely not exactly. And if it is structured anyway similar to UTF8 then it might actually show exactly the same amount of bytes as it contains characters if it contains western English text only. I guess I used somehow bad words to describe what I wanted to do. You are right that the crossing of memory borders is the place where string encoding needs to be taken care of. And that there are of course always problems with one encoding not translating exactly one to one to another one. As such the UTF encodings are the most universal ones as they support basically all the currently known characters including some that haven't been used for 1000 and more years. While you are right that most NI products currently use ASCII or at most Win1252 as that is the default ACP for most western Windows installations, there is certainly already a problem with existing LabVIEW applications who run on Windows installations that have been configured for different locales. There for instance, the string a DLL receives from the LabVIEW diagram can and will contain different extended ASCII characters and the DLL has to figure out what that encoding local is before it can do anything sensible with the string when it wants to be locale aware (example in case, the OpenG lvzip library which needs to translate all strings from CP_ACP to CP_OEM encoding to deal correctly (well correctly is a bit to much said here, but at least the way other ZIP utilities do) with the file names and comments when adding them to an archive and vice versa when reading them from it. Also any string written to disk or anywhere else in such a locale will look different than on a Win1252 locale when it contains extended characters. This is what I mean with the task being a nightmare for NI. Any change you guys will do, no matter how smart and backwards compatible you attempt to be, has a big potential to break things here. And it must be a huge undertaking or LabVIEW had that support already since 7.1!!! And one plea from my side, if and when NI adds Unicode string support please expose a C manager interface for that too!!!!
  11. I don't have any experience with them, but it doesn't surprise me that there are issues with that. Such managers would have to hook deep into the Windows graphic subsystem. Since Microsoft never really has planned for such an interface there are many issues to be expected since such a manager will have to intercept various low level windows messages, some of them not even documented anywhere and also with differences between various Windows versions. So they will all have some issues somewhere as they will almost never be able to fully transparently hook into the Windows graphic subsystem. X Windows which has actually a quite clear client server architecture and therefore a well documented interface between the two is also having such issues depending on X server and windows manager version and implementation since even there the servers and clients don't always implement every functionality fully correct. Imagine how harder it must be to create a properly working window manager on a system where most of this interaction is in fact undocumented and officially unexposed.
  12. The first thing you should do is to change the library path in the Call Library Node to only explicitedly say USER32.DLL. You have currently a path in there and not just a name, and in that case the LabVIEW application Builder believes that the DLL is private to the app and adds it automatically to the data folder in your app. LabVIEW then will try to load that private DLL and call its function but the handle you do pass it comes from USER32.DLL in the system folder and has absolutely no meaning inside the private copy of USER32.DLL and therefore crashes. The problem is in fact already happening when LabVIEW tries to load its local copy of USER32.DLL. This DLL interacts on many levels with other Windows kernel internas and tries to do all kinds of stuff to initialize the Windows API system. However that conflicts with the initialization the system DLL has made when it was loaded at computer startup and therefore Windows simply shutdowns the process. After you rebuilt your app, make sure you don't end up with a user32.dll file inside your built application directory anymore. This should fix the crash in the built app. Another change you should do is to make the HWND control an U64 control, remove the U32 conversion in Get HWnd From VI Ref.vi, and change the according parameter in the Call Library Node to be a pointer sized integer. Otherwise you will run into nasty stuff again when you ever move your application to LabVIEW for Windows 64 bit.
  13. In other words to what Logman said: if you have a bag that is to small to put in 6 apples in their own little baggy, then try to put in 1 apple a time without baggy, you still won't be able to to put in all 6 apples!
  14. Performance is likely not that much of a concern in this application but I would definitely implement this as a single 64 bit integer (or maybe two 32 bit integers) and use boolean logic on it to compare and work with it. "old integer" EXOR "new integer" != 0 will tell you if something has changed and then you can eventually detect which bits changed too. It's a little bit more mathematics than trying to do it with a boolean array but works much faster and with less code.
  15. This is all nice and good as long as you can assume that you deal with ANSI strings only (with optionally an extended character set, which is however codepage dependent and therefore absolutely not transparently portable from one computer to the next). And it is not even fully right in LabVIEW now, since LabVIEW really uses multibyte (MBCS) encoding. So autinindexing over a string has a serious problem. Some would expect it to return bytes, I would expect it to return characters, which is absolutely not the same in MBCS and UTF encoding. The only way to represent a MBCS or UTF character as a single numeric on any platform would be to use ultimately UTF32 encoding, which requires 32 bit characters, but not all platforms on which LabVIEW runs support that out of the box and adding iconv or icu support to a realtime platform has some far reaching consequences in terms of extra dependencies and performance. Java internally uses exclusively Unicode and yes you have to iterate over a string by converting it to a character array or indexing the character position explicitly. And there is a strict seperation between byte stream formats and string formats. Going from one to the other always requires an explicit conversion with an optional encoding specification (most conversions also allow default encoding conversion which is usually UTF8).
  16. Currently you are quite right. However once NI adds Unicode support (if and when they do it) you will run into problems if you just assume that string == byte array. So better get used to the idea that they might not be the same. And there is in fact an INI key that adds prelimenary Unicode support to LabVIEW, however it still causes more trouble than it solves because of many reasons among which the following: The problem for NI here is that the traditional "string==byte array" principle has caused a lot of legacy code that is basically impossible to not break when adding Unicode support. There was once a discussion by AQ where he posed the radical change of string handling in LabVIEW to allow proper support of Unicode. All byte stream nodes such as VISA Read and Write and TCP Read and Write etc would change to accept byte arrays as input. And there would probably be a new string type that could represent multi byte and wide char strings while the current string type would slowly get depreciated. Difficulties here are that the various LabVIEW platforms support different types of wide chars (UTF16 on Windows, UTF32 on Unix and only UTF8 at most on most realtime systems). So handling those differences in a platform independent manner is a big nightmare. Suddenly string length can either mean byte length, which is different on different platforms or character length which is quite time consuming to calculate for longer strings. Most likely when flattening/converting strings to a byte stream format they would have to be translated to UTF8 which is the largest common denominator for all LabVIEW platforms (and the standard format for the web nowadays). All in all a very large and complicated undertaking but one NI is certainly working on in the background for some years already. Why they haven't started to change the bytestream nodes to at least accept also byte arrays or maybe better even change them to take byte arrays only, I'm not sure.
  17. Well that is of course the most easy solution but maybe not the quickest . Alternatively you could make use of the unicode.llb library in this post.
  18. Hmmmm, that TCHAR in there!! Do you compile your test application as Unicode or ASCI?
  19. That is C++ name mangling. The developer of the DLL forgot to tell the compiler/linker to not mangle the exported function names. It looks ugly and can be inconvinient but can't be the reason for your runtime error. Looking at the function prototype and the CLN configuration I have to say that there is no obvious problem visible. I would rather suspect that the DLL needs to have another function called first before you are allowed to call this function. Or there is a bug in the DLL (well I would consider the possible requirement to first call another function before you can call Initialize() a bug in itself ).
  20. No you haven't dreamed but the Vision Builder makes use of a NI special runtime engine that is located in lvfrt.dll. This is a private build that supposedly works as a runtime engine but with most of the compiling and other full development system still in place. However I have no idea how one would create an installer that deploys this runtime version rather than the standard version. If your only concern would be the variable names, I do have a completely rewritten version of the formula parser that allows for arbitrary (well must start with alpha character and then can contain any alphanumeric character and the underscore) and performs quite a bit better than the NI parser as it does not do all kinds of complicated string reformating on the input string. It also has a clean string to RPN parser so that as long as the string doesn't change one can simply execute the RPN evaluator only, which speeds up the actual calculation of the formula even more. The code was posted long ago here.
  21. Not ideal but the only possible solution then: Create a string constant and copy the script into it and then put the script in a case structure and the string constant in the other case of the structure. Now you can call the VI with a boolean input control to execute the string or retrieve the contents. Requires some discipline to update the string constant when the developer makes changes to the script but is the most straightforward and simple solution if you do not want to go with an external script solutions. Or alternatively if your required scripting formulas are not to complex you might go with the script parser that comes as example in LabVIEW. It is however limited to basic mathematical operations, doesn't support arrays, and interprets the formula each time you execute it.
  22. I don't think any of these methods will work in a build executable. 1) because it is not supported in the runtime engine, 2) because it makes use of the node in 1) and 3) only maybe if you set the VI explicitedly to not remove the diagram when building the executable. The text of the script is part of the diagram like anything else. LabVIEW compiles this in fact into code and then the script text is not really necessary anymore in a build application and therefore gets removed with the diagram. But even if you leave the diagram there it may still not work as a lot of VI scripting operations do not work in the runtime engine since they don't make to much sense anyways when there is usually anyhow no diagram to work on. Also since the formula node is really compiled into the rest of the VI code, you can't change it in a build application anyways as it would need to be recompiled but the runtime engine does not have any compilation possibilities. What you want to do is probably using some external scripting solution like LabPython or Lua for LabVIEW as there you can have the script in the form of a string that you can load from disk or simply contain in your VI and even let the user modify to run the changed code.
  23. Well, not sure it provides more options than the ActiveX interface. And there are quite a lot of Excel related hierarchies such as Microsoft.Office.Interop.Excel, Microsoft.Office.Tools.Excel, etc, but only the first one seems to include public accessible contructors for the various interesting objects. Personally I think trying to interface to Excel through .Net is mostly an exercise with little merits other than learning about .Net interfacing.
  24. Unless you use LabVIEW for Windows 64 Bit, you can have 100's of GB of memory and your application is still limited to 2GB of memory maximum. This is inherent to the 32 bit architecture. Due to various components loaded by LabVIEW the limit of usable memory is usually more around 1.3GB. The 2GB is maximum usable memory and there needs to fit in your application, any modules it may use and some temporary management information for LabVIEW and Windows. The Excel plugin being ActiveX doesn't really help this as ActiveX in itself is quite a heavy weight technology. But don't worry, .Net wouldn't be better.
  25. You are of course right about only needing two comparisons too. However you switched the Native and AQ time control. And interestingly the "real" AQ comparison is ALWAYS faster on my machine than the other two, with your comparison usually being slightly slower than the native one. However the overall variation between runs is generally higher than the difference between the three methods in one run.
×
×
  • Create New...

Important Information

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