Company Events Academic Community Support Solutions Products & Services Contact NI MyNI

Porting VIs among Platforms

LabVIEW 2013 Help

Edition Date: June 2013

Part Number: 371361K-01

»View Product Info

Portability issues include differences in filenames, separator characters, resolutions and fonts, possible overlapping of labels, and differences in picture formats.

Portable and Nonportable VIs

VIs are portable among all platforms on which LabVIEW runs as long as the versions of LabVIEW are the same. VIs that contain platform-specific features, such as .NET or ActiveX, are not portable. Porting in these cases breaks the VIs.

LabVIEW uses the same file format on all platforms.

When you open the VI on the new platform, LabVIEW detects the VI is from another platform and recompiles the VI to use the correct instructions for the current processor. If you transfer VIs on a disk formatted for a different platform, you may require a utility program to read the disk, such as Apple File Exchange on Macintosh.

You cannot port the following VIs:

  • VIs distributed in the vi.lib directory — Each distribution of LabVIEW contains its own vi.lib. Do not move VIs in vi.lib across platforms.
  • Compatibility VIs — LabVIEW uses compatibility VIs if you created VIs in earlier versions of LabVIEW and open them in a newer version of LabVIEW. Compatibility VIs emulate functionality in previous versions of LabVIEW. Porting breaks these VIs because they call shared libraries that are platform-specific.
  • VIs that contain the Call Library Function Node — Porting breaks these VIs unless they can find a library of the same name as the Call Library Function references.
  • Platform-specific communication VIs, such as .NET or ActiveX functions on Windows and AppleEvents VIs on Mac OS X.
  • The VISA Peek and VISA Poke functions.

Filename Differences

To ease porting VIs among platforms, consider the VI filename. Windows, Mac OS X, and Linux filenames can have 255 characters, including the .vi extension. Avoid using characters in a filename that are invalid on another platform. The colon (:) is invalid on Mac OS X, the slash (/) is invalid on Linux, and the following characters are invalid on Windows: \, /, :, *, ?, ", <, >, and |.

To avoid complications, save VIs with names valid for all platforms or save them in an LLB. The LLB name must conform to platform limits, but VIs in LLBs can have names up to 255 characters, regardless of platform. Thus, LLBs are the most convenient format for transferring VIs because LLBs eliminate most file system dependencies.

Filenames are case sensitive on Linux but not elsewhere. If you refer to a VI by name, capitalize the name consistently wherever you use it.

Separator Character Differences

If you develop a VI for use on other platforms, do not use platform-specific path separator characters \ , / , : in filenames. Avoid any special characters in filenames because different file systems interpret them differently. For example, hidden files on Linux begin with a period.

Resolution and Font Differences

Fonts can vary from platform to platform. After you port a VI, select new fonts to obtain an appealing display. When you design VIs, keep in mind the three fonts that map best among platforms: the Application font, the System font, and the Dialog font.

The Application font is the LabVIEW default font used in the Controls palette, the Functions palette, the context help, and tip strips.

  • (Windows 7/Vista) LabVIEW uses Segoe UI by default.
  • (Windows XP) LabVIEW uses the font that Windows uses for filenames in Windows Explorer. The U.S. version of Windows usually uses Tahoma. The size of the font depends on the settings of the video driver because you can set higher resolution video drivers to use Large Fonts or Small Fonts. In order to maintain consistency, use Small Fonts and Windows standard settings.
  • (Mac OS X) LabVIEW uses Lucida Grande by default.
  • (Linux) LabVIEW uses Helvetica by default.

The System font is the LabVIEW default font used for menus.

  • (Windows 7/Vista) LabVIEW uses Segoe UI by default.
  • (Windows XP) LabVIEW uses the same as the Application font, but the font size may differ.
  • (Mac OS X) LabVIEW uses Lucida Grande by default.
  • (Linux) LabVIEW uses Helvetica by default.

The Dialog font is the LabVIEW default font used for text in dialog boxes and system controls.

  • (Windows 7/Vista) LabVIEW uses Segoe UI by default.
  • (Windows XP) LabVIEW uses the same font as the Application font.
  • (Mac OS X) LabVIEW uses Lucida Grande by default.
  • (Linux) LabVIEW uses Helvetica by default.

When you port a VI that contains one of these fonts to another platform, LabVIEW ensures the font maps to something similar on that platform.

If you do not use the defined fonts, the font can change size on the new platform because of the differences in the fonts available and differences in the resolution of the display on the other platform. For example, if you select Geneva or New York on the Macintosh and port the VI to Windows, LabVIEW cannot find that font name on Windows and substitutes it with Arial. The substituted font may not match the original, and objects may overlap. If you port a VI to Windows and Windows does not recognize the fonts, the new font may display differently.

Similarly, a font may not be recognized on another language system. For example, a Japanese system may not recognize the Windows font Arial. Use Application, Dialog, and System fonts to avoid resetting the fonts after localizing an application.

If you use a defined font on a section of text, avoid changing the size of that text. If you change the font to something other than the default size and then port the VI to a different platform, LabVIEW tries to match the font with the new size, which might be inappropriate depending on the resolution of the screen.

Character Code Issues

A computer represents data as bytes. It stores letters and other characters by assigning each a character code.

In the simplest case, one byte corresponds to one character according to a mapping table, or encoding. U.S. computer systems use single-byte encoding, which represents up to 256 characters. Other systems, such as Japanese or Chinese systems, use multi-byte encoding to represent several thousand characters.

Note  In applications on multi-byte systems, do not attempt to parse a string by converting the string into an array of bytes because certain characters may use two bytes. Some String functions do not handle multi-byte characters.

Among the various encoding, the most common are ASCII and ISO Latin I, which is an extension of ASCII.

ASCII encoding is a 7-bit code (from 0 to 127). It contains upper and lowercase English, American English punctuation, base 10 numbers, and a few control codes. Control codes are a set of non-displayable characters used for text formatting. You can print most of the ASCII characters in the \0x21 to \0x7F range.

To represent international characters, single-byte operating systems use an 8-bit extension of ASCII. The lower 128 character codes are identical to ASCII, and the upper 128 are different for each code page. The various international characters reside in the upper 128 character codes. Windows, Linux, and Mac OS X use 8-bit character sets, but they each map differently, which causes portability problems.

For the United States and Western European countries, Windows and Linux use the same code page. A code page is a list of selected character codes in a certain order. Mac OS X uses a different code page than Windows and Linux. For Japanese operating systems, all platforms use the same code page, so portability is less of an issue for a Japanese application.

When you port a VI from one platform to another, such as from Macintosh to PC or from PC to Macintosh, you might encounter problems because of the differences between platform code pages, especially if you use non-ASCII characters in the upper 128 range. For example, the word café in French uses the extended character é, whose hexadecimal value is \0xE9 on the PC. This same hexadecimal value represents the character È on the Macintosh.

LabVIEW performs a code page conversion for elements such as captions, VI and parameter tips and descriptions, VI titles, and other private data. Private data is listbox item names, table row and column headers, font used for table cells, graph plot names, graph annotation names, and cursor names. However, LabVIEW does not map labels or string content. Labels and string content might not appear as you expect after you port them to a new platform, and you may need to modify them manually. Therefore, if you plan to port your VIs from Windows or Linux to Mac OS X and vice versa, avoid using international characters in labels or string content. However, you can port a Japanese application without restriction from Windows or Linux to Macintosh because these platforms use the same code page for Japanese.

For example, LabVIEW does not map string content because strings can be interpreted as binary information. If you communicate with an instrument using GPIB or serial communication and if your instrument expects the binary string \0x63\0x61\0x66\0xE9, this string appears as café on the Windows platform, and it appears as cafÈ on the Macintosh platform. In both cases, you should send the same binary string to the instrument. To avoid this communication error, LabVIEW does not perform character mapping on string values.

LabVIEW does not map labels because it can break VIs, such as using the Unbundle by Name function. The VI is broken because when you change the label, the reference to the control becomes invalid.

Overlapping Labels

When you move a VI to a new platform, controls and labels might change size, depending on whether the fonts are smaller or larger on the new platform. LabVIEW tries to keep labels from overlapping their owners by moving them away from the owning control. Also, every label and constant has a default Size to Text attribute. When you first create a label or constant, this attribute is set so the bounds of the object resize as necessary to display all the enclosed text.

If you manually resize the label, LabVIEW turns off this attribute, and the item in the shortcut menu no longer shows a checkmark. With Size to Text turned off, the bounds of the object stay constant, and LabVIEW clips or crops the enclosed text as necessary. If you do not want LabVIEW to clip text when you move among platforms, leave this attribute on for labels and constants. After you resize the label, you can manually turn on Size to Text.

Not all computers have high-resolution monitors. However, if you have a monitor with a high resolution, do not make your front panels very large if you want them to port well. For best portability results, leave extra space between controls and avoid overlapping controls. When you port a label that overlaps another label, it might overlap the whole control when you enlarge the font on the new platform.

Picture Differences

The most basic type of picture contains a bitmap, which is a series of values that specify the color of each pixel in the picture. More complex pictures can contain commands the computer system executes every time it displays the picture.

Use the paint layer of a graphics application to create bitmap-based pictures. Bitmaps are common storage formats for pictures on all platforms. If you use pictures that contain bitmaps on front panels, the pictures usually look the same when you load the VIs on another platform. However, pictures that contain drawing commands such as filling might include commands that other platforms do not support. Check how VIs look on another platform if you expect to use them there.

Use the draw layer of a graphics application to create pictures that contain drawing commands. To make the pictures more portable, paste the final picture into a paint layer of a graphics application before you import the picture into the VI.

(Windows and Mac OS X) With some graphic applications on Windows and many graphics applications on Mac OS X, you can cut or copy a picture with a nonrectangular shape. For example, on Mac OS X, you can use a Lasso tool to select the outline of a circle, triangle, or a more complicated shape such as a musical note.

Other platforms might draw these irregular shapes on a rectangular white background. On Windows, if you want pictures with irregular shapes and pictures that scale well, use applications that support enhanced metafiles.


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit