LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error compiling LabVIEW VI into DLL: Error generating type library / Error -2147221480 occurred at Building DLL stub.

I'm attempting to compile a LabVIEW VI into a DLL, which will then be called by a MATLAB MEX function.

I've done this successfully in the past with VIs that only had a few inputs and outputs. The VI I'm encountering this problem with has one double array input and 24 double array outputs.

When I attempt to build the DLL, the following error message is displayed:

LabWindows/CVI Message: Mktyplib.exe failed while compiling the odl file used to create the type library. You can save the odl file and then use the odl file with the command line:

"c:\program files\national instruments\labview 6.1\applibs\lvdllbuilder\sdk\bin\mktyplib.exe" /win32 /nocpp /tlb "SharedLib.tlb" "c:\Documents and Settings\zlerner\Local Settings\Temp\dlltemp\SharedLib.odl"

to see what errors mktyplib.exe reported.

Using the command line included in the error message returns the following:

c:\Documents and Settings\zlerner\Local Settings\Temp\dlltemp\SharedLib.odl (10): fatal error M0001: Syntax error near line 10 column 2048: unexpected end-of-file

This error appears to be the result of the large number of output variables the VI uses. The exported function declaration in the .odl file is contained on a single line with more than 2048 characters, which appears to be the maximum length that mktyplib.exe can read. The command line above executes propertly if SharedLib.odl is manually edited to split the declaration into multiple lines. However, this file is generated dynamically during compilation, and I can't find a way to force LabVIEW to use the manually edited version.

Any suggestions you can offer will be greatly appreciated.

Thank you,

Zach Lerner
zlerner@onwafer.com
Software Engineer
OnWafer Technologies, Inc.

I'm including a test VI and .bld file that exhibit this problem.

One note on running the command line included in the above error message. The .odl file that it references is automatically deleted by LabVIEW at the end of the DLL build process. Therefore, do not press OK when the "'C:\...\zlerner\Local Settings\Temp\dlltemp\SharedLib.odl' successfully created." dialog is displayed if you want to be able to access SharedLib.odl.
0 Kudos
Message 1 of 3
(3,695 Views)
I tried the same thing on my machine and received the same results. It appears that you are right about the length of the function declaration. I would suggest, as a workaround, to rename some of the parameters to shorter names. By default, they can have rather long names. You could change these to cut down on the length of the declaration. Let us know if you find anything.
J.R. Allen
Message 2 of 3
(3,695 Views)
Thanks for the response. I actually already tried that, using a, b, c, d, ... instead of in1, out1, out2, out3, ... for the variable names.

It appears that the excessive length of the declaration in SharedLib.odl isn't coming from the variable names, but from some other associated keywords. For example, here's the entry corresponding to the output variable out1:

[in, out, custom(53D57340-9A16-11d0-A62C-0020AF16F98E, 1), custom(746B27E2-FBD8-11d1-B311-0060970535CB, "[]")] float64 *out1

I'm not really sure what the purpose of those alphanumeric strings (UUIDs?) is, but I wonder if there is some way to force LabVIEW to use a more conscise format in the declaration or to add carriage returns after each entry.

As before, all comments are appreciated
.

Thanks,
Zach
0 Kudos
Message 3 of 3
(3,695 Views)