Discussion:
[omniORB] omniidl does not generate code - I'm mystified...
Frank Goenninger
2009-11-14 15:15:07 UTC
Permalink
Hello all,

being a bloody beginner I am trying to get omniidl to generate code
from the following IDL file:

-X-X-X-

#ifndef __FLEXIO__
#define __FLEXIO__

#pragma prefix "flexio.goenninger.net"

module FlexIO
{
typedef long rc_t;
typedef unsigned long operation_t;
typedef unsigned long data_t;
typedef unsigned long * data_ptr;
typedef unsigned long device_id_t;

interface LowLevelIO
{
rc_t select_device( in device_id_t device_id );

rc_t read( in operation_t operation,
in data_t data1,
in data_t data2,
out data_ptr rtn );

rc_t write( in operation_t operation,
in data_t data1,
in data_t data2 );
};
};

#endif

-X-X-X-

omniidl gets called like this:

$ omniidl -bcxx flexio.idl

Results are:

flexio.hh:

-X-X-X-

// This file is generated by omniidl (C++ backend)- omniORB_4_2. Do
not edit.
#ifndef __flexio_hh__
#define __flexio_hh__

#ifndef __CORBA_H_EXTERNAL_GUARD__
#include <omniORB4/CORBA.h>
#endif

#ifndef USE_stub_in_nt_dll
# define USE_stub_in_nt_dll_NOT_DEFINED_flexio
#endif
#ifndef USE_core_stub_in_nt_dll
# define USE_core_stub_in_nt_dll_NOT_DEFINED_flexio
#endif
#ifndef USE_dyn_stub_in_nt_dll
# define USE_dyn_stub_in_nt_dll_NOT_DEFINED_flexio
#endif






#ifdef USE_stub_in_nt_dll
# ifndef USE_core_stub_in_nt_dll
# define USE_core_stub_in_nt_dll
# endif
# ifndef USE_dyn_stub_in_nt_dll
# define USE_dyn_stub_in_nt_dll
# endif
#endif

#ifdef _core_attr
# error "A local CPP macro _core_attr has already been defined."
#else
# ifdef USE_core_stub_in_nt_dll
# define _core_attr _OMNIORB_NTDLL_IMPORT
# else
# define _core_attr
# endif
#endif

#ifdef _dyn_attr
# error "A local CPP macro _dyn_attr has already been defined."
#else
# ifdef USE_dyn_stub_in_nt_dll
# define _dyn_attr _OMNIORB_NTDLL_IMPORT
# else
# define _dyn_attr
# endif
#endif













#undef _core_attr
#undef _dyn_attr





#ifdef USE_stub_in_nt_dll_NOT_DEFINED_flexio
# undef USE_stub_in_nt_dll
# undef USE_stub_in_nt_dll_NOT_DEFINED_flexio
#endif
#ifdef USE_core_stub_in_nt_dll_NOT_DEFINED_flexio
# undef USE_core_stub_in_nt_dll
# undef USE_core_stub_in_nt_dll_NOT_DEFINED_flexio
#endif
#ifdef USE_dyn_stub_in_nt_dll_NOT_DEFINED_flexio
# undef USE_dyn_stub_in_nt_dll
# undef USE_dyn_stub_in_nt_dll_NOT_DEFINED_flexio
#endif

#endif // __flexio_hh__

-X-X-X-

... with flexioSK.cc being similarly empty ...

What am I doing wrong ?? Any hint really appreciated.

Environment:
OmniORB 4.1.4, Mac OS X 10.5.8

Oh, and yes, the Echo example runs just fine !!!

Thanks again -

Frank
Kevin Bailey
2009-11-14 21:25:58 UTC
Permalink
Post by Frank Goenninger
Hello all,
being a bloody beginner I am trying to get omniidl to generate code from
-X-X-X-
#ifndef __FLEXIO__
#define __FLEXIO__
#pragma prefix "flexio.goenninger.net"
module FlexIO
{
typedef long rc_t;
typedef unsigned long operation_t;
typedef unsigned long data_t;
typedef unsigned long * data_ptr;
typedef unsigned long device_id_t;
interface LowLevelIO
{
rc_t select_device( in device_id_t device_id );
rc_t read( in operation_t operation,
in data_t data1,
in data_t data2,
out data_ptr rtn );
CORBA hasn't added pointers since I last used it, has it ?
If not... How would CORBA implement them on platforms
without pointers ? What good would a pointer be to a completely
different process on a completely different host ? Different
architecture perhaps.

Instead, just use "out" parameters to implement returned data
(as you seem to have done.)

rc_t read(...
out data_t rtn);

Or maybe an out array if it will return multiple words.

Cheers
Frank Goenninger
2009-11-14 21:52:35 UTC
Permalink
Post by Kevin Bailey
Post by Frank Goenninger
Hello all,
being a bloody beginner I am trying to get omniidl to generate code from
-X-X-X-
#ifndef __FLEXIO__
#define __FLEXIO__
#pragma prefix "flexio.goenninger.net"
module FlexIO
{
typedef long rc_t;
typedef unsigned long operation_t;
typedef unsigned long data_t;
typedef unsigned long * data_ptr;
typedef unsigned long device_id_t;
interface LowLevelIO
{
rc_t select_device( in device_id_t device_id );
rc_t read( in operation_t operation,
in data_t data1,
in data_t data2,
out data_ptr rtn );
CORBA hasn't added pointers since I last used it, has it ?
No, it didn't, you're right. Yet I did not get any error output of
omniidl. Stupid me, that's what I expected when I am using some
illegal syntax in an IDL file.
Post by Kevin Bailey
If not... How would CORBA implement them on platforms
without pointers ? What good would a pointer be to a completely
different process on a completely different host ? Different
architecture perhaps.
Pointers are a mess of a concept to begin with, so better not
implement them at all ;-)
Post by Kevin Bailey
Instead, just use "out" parameters to implement returned data
(as you seem to have done.)
rc_t read(...
out data_t rtn);
Or maybe an out array if it will return multiple words.
Brave as I am I changed my IDL file to the following:

-X-X-X-

#ifndef __FLEXIO__
#define __FLEXIO__

#pragma prefix "flexio.goenninger.net"

module FlexIO
{
typedef long rc_t;

typedef unsigned long device_id_t;
typedef unsigned long bus_id_t;

struct FlexIOServerInfo
{
string ip_hostname;
unsigned long tcp_port;
};

typedef struct FlexIOServerInfo flexioserverinfo_t;

struct FlexIODeviceInfo
{
device_id_t id;
string name;

flexioserverinfo_t server;
bus_id_t bus_id;
};

typedef sequence<FlexIODeviceInfo> flexiodeviceinfoseq_t;

struct FlexIOInfo
{
long nr_devices;
flexiodeviceinfoseq_t device_info_list;
};

typedef struct FlexIOInfo flexioinfo_t;

interface DeviceSelection
{
rc_t get_flexio_info( out flexioinfo_t flex_io_info );
rc_t select_device( in device_id_t device_id );
};

typedef unsigned long flexio_op_id_t;
typedef unsigned long flexio_data_t;

interface LowLevelIO
{
rc_t read( in flexio_op_id_t operation,
in flexio_data_t data1,
in flexio_data_t data2,
out flexio_data_t return_value );

rc_t write( in flexio_op_id_t operation,
in flexio_data_t data1,
in flexio_data_t data2 );
};
};

#endif

-X-X-X-

... a bit more complex, but in line with what I can read in my Corba
book "Pure Corba" (SAMS, Fintan Bolton). No pointers used. Still no
output.

A call to omniidl to verify the IDL file returns no errors. Ok, I am
just about to try some other ORB for this ... Or does OmniORB behave a
bit different? In which way?

Mayday! Mayday! Lost engine 1 and 2, engine 3 on fire - engine 4
almost without fuel ...

Frank
Duncan Grisby
2009-11-15 02:18:02 UTC
Permalink
On Sat, 2009-11-14 at 10:14 +0100, Frank Goenninger wrote:

[...]
Post by Frank Goenninger
$ omniidl -bcxx flexio.idl
-X-X-X-
// This file is generated by omniidl (C++ backend)- omniORB_4_2. Do
not edit.
[... empty generated code...]
Post by Frank Goenninger
What am I doing wrong ?? Any hint really appreciated.
OmniORB 4.1.4, Mac OS X 10.5.8
omniidl thinks your IDL file is empty. I don't know why. The fact that
omniidl isn't seeing your IDL explains why it doesn't complain about the
errors in the IDL.

The empty generated code claims to come from omniORB 4.2 (the current
development branch), yet you say you are using omniORB 4.1.4. What
exactly are you doing, and how? Give step-by-step details of exactly
what you have done.
Post by Frank Goenninger
Oh, and yes, the Echo example runs just fine !!!
How does the way you are running omniidl differ from the way omniidl is
run when the echo example is compiled? If the echo example works,
omniidl is clearly working fine.

Cheers,

Duncan.
--
-- Duncan Grisby --
-- ***@grisby.org --
-- http://www.grisby.org --
Frank Goenninger
2009-11-15 03:04:38 UTC
Permalink
Hi Duncan,

glad you're jumping in on this !
Post by Duncan Grisby
omniidl thinks your IDL file is empty. I don't know why. The fact that
omniidl isn't seeing your IDL explains why it doesn't complain about the
errors in the IDL.
The empty generated code claims to come from omniORB 4.2 (the current
development branch), yet you say you are using omniORB 4.1.4. What
exactly are you doing, and how? Give step-by-step details of exactly
what you have done.
I have to correct myself here: It actually is 4.2, the development
branch.
Post by Duncan Grisby
How does the way you are running omniidl differ from the way omniidl is
run when the echo example is compiled? If the echo example works,
omniidl is clearly working fine.
Let's see:

1. I cloned the Echo example in my own little omniorb-test project:

$ more omniorb-test.idl
interface Echo
{
string echoString(in string mesg);
};

$ omniidl -bcxx omniorb-test.idl

produces fully intact files omniorb-test.hh and omniorb-testSK.cc
which I have successfully used to play with various aspects of POA and
Name Service.

I then went on to create my real project. I started with an new
directory "~/flexio/idl" and put the IDL file as given here:

-X-X-X-

#pragma prefix "flexio.goenninger.net"

module FlexIO
{
interface DeviceSelection;
interface LowLevelIO;

typedef long rc_t;

typedef unsigned long device_id_t;
typedef unsigned long bus_id_t;

struct FlexIOServerInfo
{
string ip_hostname;
unsigned long tcp_port;
};

typedef struct FlexIOServerInfo flexioserverinfo_t;

struct FlexIODeviceInfo
{
device_id_t id;
string name;

flexioserverinfo_t server;
bus_id_t bus_id;
};

typedef sequence<FlexIODeviceInfo> flexiodeviceinfoseq_t;

struct FlexIOInfo
{
long nr_devices;
flexiodeviceinfoseq_t device_info_list;
};

typedef struct FlexIOInfo flexioinfo_t;

interface DeviceSelection
{
rc_t get_flexio_info( out flexioinfo_t flex_io_info );
rc_t select_device( in device_id_t device_id );
};

typedef unsigned long flexio_op_id_t;
typedef unsigned long flexio_data_t;

interface LowLevelIO
{
rc_t read( in flexio_op_id_t operation,
in flexio_data_t data1,
in flexio_data_t data2,
out flexio_data_t return_value );

rc_t write( in flexio_op_id_t operation,
in flexio_data_t data1,
in flexio_data_t data2 );
};
};

-X-X-X-

Then:

$ cd ~/gnc/flexio/idl

$ ll
total 8
-rw-r--r--@ 1 frgo staff 2660 14 Nov 21:35 flexio.idl

Making sure I am using the right omniidl:

$ type omniidl
omniidl is hashed (/opt/orb/bin/omniidl)

Ok, this is where I installed it. So, let's call it for code
generation for flexio.idl:

$ omniidl -bcxx flexio.idl

gives:

$ ll
total 24
-rw-r--r-- 1 frgo staff 1552 14 Nov 21:41 flexio.hh
-rw-r--r--@ 1 frgo staff 2660 14 Nov 21:35 flexio.idl
-rw-r--r-- 1 frgo staff 347 14 Nov 21:41 flexioSK.cc

with flexio.hh and flexioSK.cc being the "empty" files.

I then went on to see what omniidl sees as preprocessing output:

$ omniidl -E -bcxx flexio.idl

gives:

# 1 "flexio.idl"
??#pragma prefix "flexio.goenninger.net"

module FlexIO
{
interface DeviceSelection;
interface LowLevelIO;

typedef long rc_t;

typedef unsigned long device_id_t;
typedef unsigned long bus_id_t;

struct FlexIOServerInfo
{
string ip_hostname;
unsigned long tcp_port;
};

typedef struct FlexIOServerInfo flexioserverinfo_t;

struct FlexIODeviceInfo
{
device_id_t id;
string name;

flexioserverinfo_t server;
bus_id_t bus_id;
};

typedef sequence<FlexIODeviceInfo> flexiodeviceinfoseq_t;

struct FlexIOInfo
{
long nr_devices;
flexiodeviceinfoseq_t device_info_list;
};

typedef struct FlexIOInfo flexioinfo_t;

interface DeviceSelection
{
rc_t get_flexio_info( out flexioinfo_t flex_io_info );
rc_t select_device( in device_id_t device_id );
};

typedef unsigned long flexio_op_id_t;
typedef unsigned long flexio_data_t;

interface LowLevelIO
{
rc_t read( in flexio_op_id_t operation,
in flexio_data_t data1,
in flexio_data_t data2,
out flexio_data_t return_value );

rc_t write( in flexio_op_id_t operation,
in flexio_data_t data1,
in flexio_data_t data2 );
};
};

The "??" appears whatever I have in the first line. Comparison with
the omniorb-test.idl file:

$ omniidl -E -bcxx omniorb-test.idl

# 1 "omniorb-test.idl"
interface Echo
{
string echoString(in string mesg);
};

Aha! No "??" at the beginning. Strange! Now: Let's see the file
contents at the byte level:

$ od -c omniorb-test.idl

0000000 i n t e r f a c e E c h o \n

Good. Now flexio.idl:

$ od -c flexio.idl

0000000 377 376 # \0 p \0 r \0 a \0 g \0 m \0 a \0

Aha! So: 2-byte coded file versus 1-byte coded file. Converting to 1-
byte coded file and re-issueing omniidl gives:

$ omniidl -bcxx flexio.idl
flexio.idl:19: Declaration of struct 'FlexIOServerInfo' clashes with
earlier declaration of struct 'FlexIOServerInfo'
flexio.idl:14: (struct 'FlexIOServerInfo' declared here)
flexio.idl:19: Syntax error in struct definition
flexio.idl:38: Declaration of struct 'FlexIOInfo' clashes with earlier
declaration of struct 'FlexIOInfo'
flexio.idl:33: (struct 'FlexIOInfo' declared here)
flexio.idl:38: Syntax error in struct definition
omniidl: 4 errors.

I have a valid output - this being errors, well ;-) Mystery solved.
Still: I think an error output and a hint in the docs would be
helpful. Note: I generated the file in Mac OS X's Xcode program, the
standard IDE on OS X. I have set the encoding default to UTF-8 which
caused this problem, not knowing omniidl wouldn't recognize UTF-8
encoded files. It may be in the docs somewhere (I didn't check) but it
sure would help if there was a warning or error message when running
omniidl and it nit generating any contents.

Thanks for putting me on the right track!

Cheers
Frank

Loading...