[etherlab-dev] Problems interfacing C++ application to Igh EtherCAT master

Steffen Dalgard steffen.sint at gmail.com
Fri Apr 5 22:57:36 CEST 2013

I am working for a EU founded project named CORBYS (www.corbys.eu)
developing a training device for gait rehabilitation. We plan to use Igh
Ethercat together with OROCOS and ROS running Linux 10.04 for our robotic

I have tested a very basic test application as a C program based on the Igh
  This works as expected.

I have started to make a C++ framework for an application interfacing to
  This is based on my working C test program rewritten into a C++ class
  The final program is planned to support 15 slavetypes with 50 slaves

It seems that C++ doesnt like the way ecrt.h does forward referencing of
data structures.

In the file ecrt.h file the structure ec_master is declared as follows:

     * Data types
    struct ec_master;
    typedef struct ec_master ec_master_t; /**< \see ec_master */

This is the only declaration of the structure in this header file.
My impression is that the content of the structure is resolved when linking
with the library

When including this in my C++ files i am importing ecrt.h in "C-mode"
    extern "C" {
    #include "ecrt.h"
The data structures declared in ecrt.h are used as members in class objects.
    class RtnIf {
        ec_master_t *MasterPtr;
When compiling the compiler reports the following error:
error: ISO C++ forbids declaration of ‘ec_master_t’ with no type
error: expected ‘;’ before ‘*’ token

Do you have experience interfacing Igh to C++?

Currently I have tested this as a user space application.
Do you have experience using C++ in kernel-mode?

I wonder whether there has to be made a set of wrapper functions copying
the data needed into new locally defined data structures.

More details and examples can be added if needed.

Any comments welcome.

Best regards
Steffen Dalgard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.etherlab.org/pipermail/etherlab-dev/attachments/20130405/2b3cabb7/attachment-0002.htm>

More information about the Etherlab-dev mailing list