February 2007

Sun Mon Tue Wed Thu Fri Sat
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28      
Blog powered by TypePad

C++/CLI and Pointers

Just had an interesting support issue and I ended up learning some new syntax in C++/CLI, so I thought I'd share it with you. This has to do with passing values by reference and how they map within LabVIEW.

So, here is the question - you want to create a method in .NET that passes an integer by reference, and have that map correctly within LabVIEW.

Continue reading "C++/CLI and Pointers" »

LabVIEW and Google Earth

Thought I'd direct those interested to this discussion forum post regarding getting LabVIEW and Google Earth to work together. They're currently using the ActiveX interface, but you should be able to use the Web Service version as well.

Next is to get some examples with Microsoft's Virtual Earth...hopefully I'll be out of crunch soon and can put some time to it myself. If you do give it a go, make sure to leave a comment here!

Turning a VI into a Function Pointer

As you know, if you do any .NET programming in LabVIEW, you can turn a LabVIEW VI into a callback handler for a .NET event. But what if you need to supply a VI to a C function that needs a function pointer? That isn't a .NET event - it's got nothing to do with .NET...how do you create such a function pointer? Well, you could build the VI into a DLL, write some C code to convert the exported VI's C function into a pointer, call that from LabVIEW, pass that into...I'll stop there. You get the idea - it isn't trivial.

Well, vanDooren, an MVP for Visual C++, has come up with a very clever solution to the problem. Best of all (from my opinion, of course), is that it uses .NET to do it. See, .NET even can solve an interop issue between LabVIEW and C! Let's see Java to that one *laugh*.

Rather than explain the solution myself, I'll let you read it here on vanDooren's blog - after all, he's gone through the trouble of writing it up and providing screenshots, downloads and everything. As he says, writing the post is often longer than the coding. Linking to a post is an even faster solution.

Using IEnumerator in LabVIEW

In an earlier post, I described how to convert an ArrayList into a LabVIEW array via the ToArray() method. However, many of the collection types in .NET do not support this method - instead you must use the IEnumerator interface.

After receiving some questions on how best to do this, I created this example to demonstrate the way to loop through the values in the collection.

Things to remember...

  1. This can be expensive for large collections. Converting the collection to a LabVIEW array can make later code easier to write, but make sure the performance is acceptable.
  2. As I show in the example, watch for loose refnums. This is an easy place to forget to close your refnums and end up with a memory leak.
  3. This same example works for searching or any other algorithm where you need to look through the collection monotonically...it isn't just for converting to a LabVIEW array.

Browsing for ActiveX

I've seen this confusion several times, so I thought I'd do some explaining of what is going on with ActiveX support in LabVIEW. I'll get the quick version for those with A.D.D., and then go into the details.

Quick Version: Browsing for an ActiveX library is really browsing for the type library (TypeLib). Thus it has no effect on the locating of the component at runtime.

Continue reading "Browsing for ActiveX" »

That's my kind of Home Depot

A rather jaw-dropping list of tools for Windows developers!

Making LabVIEW easier to try

So, as part of the whole LabVIEW 8.20 launch, we've set up a virtual server where you can log in and try out LabVIEW, without having to download the entire thing! Just go to this site and choose the third option - Try LabVIEW Online.

Something new we're trying this time is to have a more interactive experience. We've created an "interactive multimedia" version of the Getting Started guide. Give it a try and let us know what you think of it.

I'm particularly interested in how well this works as my wife works in Computer Based Training, creating interactive training material. Gotta grow this market so she can stay employed, keeping me in the style to which I've become accustomed! :)

Diagnosis of WinSxS failures

I ran across this very handy blog post today regarding debugging WinSxS load failures. Similar to the Fusion Log tool I've talked about before for .NET, this new tool, called sxstrace, reports Fusion's attempts to locate your unmanaged assemblies.

Unfortunately, it appears that the tool is only available on Windows Vista - but there is some integration with the event logger, even back on XP.

For those of you planning on building CINs or DLLs in Visual Studio 2005 that you want to load into LabVIEW, this is one to remember.

Value vs. Reference based Classes

During NIWeek, I talked to a few customers about the new OO feature in LabVIEW 8.20 (see previous post). I was surprised by how many of them were upset that the design was value based instead of referenced based, so I thought I would add my 2 cents to the debate and explain why it's a great idea - although you do really want both available to you. However, as there are other implementations of referenced based OO in LabVIEW, the new value based approach was the right first step, in my opinion.

Continue reading "Value vs. Reference based Classes" »

New Document on LabVIEW OO Programming

For those that haven't heard,LabVIEW 8.20 has support for Object Oriented programming, with full support for classes, including inheritance and overloaded methods.

To learn more about it, we've put up a document going over the architecture in all it's gory detail.