Information
We are currently investigating an issue with the editor of some pages. Please save your work and avoid to create new pages until this banner is gone.
I am having problems with macros in IDL
The JacORB IDL compiler does not support preprocessor macros.
Summary: Always use the .midl
extension for idl files containing macros instead of .idl
Read below for a detailed explanation:
The JacORB IDL compiler does not support preprocessor macros.
This is a bad limitation of the IDL compiler (in our opinion not acceptable).
With ACS 3.1 we have introduced a separate pre-processing step for idl files containing macros.
You now have to put IDL code using macros in files with the .midl (macro-idl)
extension and add the file in the IDL_FILES
section of the Makefile.
The Makefile will automatically expand the macros generating a normal .idl
file and treat it normally, eventually installing it.
For example (see the module ACS/LGPL/CommonSoftware/enumprop), if you create the file myEnumprop.midl:
#ifndef _MYENUMPROP_MIDL #define _MYENUMPROP_MIDL #include <baci.idl> #include <enumpropMACRO.idl> module TEST { enum Bool { testFALSE, testTRUE}; ACS_ENUM(Bool); }; #endif
the Makefile will generate myEnumprop.idl with the macros expanded that you can use in any other file and that will load in the interface repository without troubles.
Before ACS 3.1, to workaround this problem, the ACS Makefile was just preprocessing IDL files with the standard CPP pre-processor before passing them to the JacORB IDL compiler.
This generally worked, but could still lead to problems in special cases.
We have in particular discovered (see SPR ALMASW2003048) that if an IDL file contianing macros is included twice, the JacORB IDL compiler does not behave correctly.
What happens is that the second time the file is included:
An easy workaround is to add one layer of include files to make sure JacORB does not try to parse the macros.
For example:
#ifndef _ENUMPROP_MACRO_IDL_ #define _ENUMPROP_MACRO_IDL_ .... macros ....... #endif /* ENUMPROP_MACRO_IDL_ */
#ifndef _ENUMPROP_MACRO_IDL_ #define _ENUMPROP_MACRO_IDL_ #include "enumpropMACRO_included.idl" #endif /* ENUMPROP_MACRO_IDL_ */
#ifndef _ENUMPROP_MACRO_INCLUDED_IDL_ #define _ENUMPROP_MACRO_INCLUDED_IDL_ .... here the same macros previously in enumpropMACRO.idl #endif /* ENUMPROP_MACRO_INCLUDED_IDL_ */