idl compilation problems

Niclas Eklund <>
Mon Jul 22 17:24:33 CEST 2002


Hello!

This is a known "problem". Initially it wasn't possible to divide
module-definitions into several IDL-files. What you should do is to put
typedef, struct, union and exception definitions in one of the IDL-files
or create a 'DataType'-module.

- "Why can't IC open an existing file and add new definitions?"

 The generated files may, for example, be created in different
 directories or old files, which should have been removed, exists.

To continue to be compatible with older versions it was not possible to
change this.

If we have:

module A {
  module B {
    struct Pos {
      double x; /**< x-coordinate */
      double y; /**< y-coordinate */
      double z; /**< z-coordinate */
    };
  };
};

...compiling test1 before test2 yields an empty A.hrl.

In this case we could skip generating the hrl-file when compiling
test1.idl. But, since the hrl-file may be included in a module or added to
a Makefile, even though it's empty, changing this could cause problems.


/Niclas




> If I have two idl-files, test1.idl and test2.idl, like these:
> 
> test1.idl:
> 
> #ifndef TEST1
> #define TEST1
> 
> module A {
>   struct Vec {
>     double x;
>     double y;
>     double z;
>   };
> };
> 
> #endif
> 
> test2.idl:
> 
> #ifndef TEST2
> #define TEST2
> 
> #include "test1.idl"
> 
> module A {
>   struct Pos {
>     double x;
>     double y;
>     double z;
>   };
> };
> 
> #endif
> 
> 
> ...and I compile then with ic:gen(), the generated .hrl file (A.hrl)
> will only contain either the Vec or the Pos struct (as a record),
> depending on in which order I compiled the files. Even if I compile
> only test2.idl (which includes test1.idl), only Pos appears in A.hrl.
> 
> I have fiddled around with preprocessor options, and using cpp instead
> of the built-in preprocessor. How do I solve this?
> 
> I'm using this ic:
> 
> 1> m(ic).
> Module ic compiled: Date: March 21 2002, Time: 16.12
> Compiler options:  [v3,
>                     debug_info,
>                     {parse_transform,sys_pre_attributes},
>                     {attribute,insert,vsn,"ic_4.1.1"},
>                     {outdir,"/home/bjowi/otp_src_R8B-0/lib/ic/src/../ebin"},
>                     {cwd,'/home/bjowi/otp_src_R8B-0/lib/ic/src'}]
> Object file: /usr/local/lib/erlang/lib/ic-4.1.2/ebin/ic.beam
> 
> 
>        /Björn Wingman







More information about the erlang-questions mailing list