LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

MIDL compile failure in activex server tool--cvi 6.0

Using CVI 6.0 on Windows 2000, I was able to build a custom activex server one time using the activex server tool.
However, subsequent compiles now all fail with:
"MIDL compiler error 2026. Consult microsoft SDK documentation ".

I thought at first I had a registry problem since I had edited the original activex interface. So I started over with a new project and re-invoked the activex server, but I am still getting the same error.

The SDK documentation didn't provide much help, other than the fact that the "IDL" file has errors.

Any ideas?
0 Kudos
Message 1 of 4
(3,582 Views)
Error MIDL2026 indicates syntax errors in the IDL file being compiled by the MIDL compiler. It is possible that your IDL file has been clobbered or that the CVI ActiveX Server Tool is generating incorrect IDL. If you post your IDL file, I am may be able to look at it and see where the syntax errors are. One way to get more information about MIDL errors is to run the MIDL compiler on your IDL file from a console command line (DOS/Shell Window); but this may not be trivial as you would have to set up the include paths, preprocessor path, and other compiler options correctly from the command line. An example command to invoke the MIDL compiler (assuming that cvi is installed in d:\cvi, and that the idl file is ...\foo.idl) is:

"d:\cvi\sdk\bin\midl.exe" "...\foo.idl" /tlb
"...\foo.tlb" /I"d:\cvi\sdk\include" /cpp_cmd "d:\cvi\bin\preprocessor.exe"

Regards,
Mohan
0 Kudos
Message 2 of 4
(3,582 Views)
Mohan,

I tried your command line, but still having several problems with the /I directive. MIDL doesn't seem to accept the include directory no matter what form I put it in. So MIDL keeps failing on "can't find aoidl.idl" type errors.

I've attached my IDL file, but I can't see anything wrong with when compared with a "good" one.

Hope you can help.
0 Kudos
Message 3 of 4
(3,582 Views)
The syntax errors are occurring because of the use of the word "module" in the IDL file. This word happens to be an IDL key-word and so MIDL complains. The ActiveX server tool will accept any valid C identifier in the various dialogs, but does not check specifically for IDL keywords.

So change all occurences of "module" to "_module" or something else and then your IDL should compile (it compiles for me). I would recommend making these changes in the ActiveX server tool itself, and not by manually editing the IDL file because the server tool will overwrite the IDL when you change the server specification and regenerate.

I don't know why your command-line is failing for aoidl.idl (I guess this should be oaidl.idl). oaidl.idl should be present in the c
vi\sdk\include folder, which should be present in the command-line in the /I option. Anyway, after changing "module" occurences you can just regenerate the server support files and rebuild from within CVI to check if this fixes your problem.

Best Regards,
Mohan
0 Kudos
Message 4 of 4
(3,582 Views)