Book a Demo

Author Topic: Reverse Engineering C++ - extern "C"  (Read 3934 times)

IFE-Doors

  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Reverse Engineering C++ - extern "C"
« on: April 30, 2015, 11:46:00 pm »
Hello to everybody,

I have tried to import existing c++ headers with classes to the class model at enterprise architect 12 (reverse engineering).
Lot of my classes were not be imported.
After some modifications to the header which was not imported I have found out that the extern "C"

Code: [Select]
#ifdef _cplusplus
extern "C"
{
#endif

class TestClass
{
...
}

#ifdef _cplusplus
}
#endif

construct at the beginning of the header file is responsible for the troubles.
Without this part it will be imported without problems. (But I needed with that construct do have the possibility to access methods from the C++ class from a C file.)

The compiler itself compiles the code correct (C++ code) because of the class keyword the compiler knows that this has to be C++ code.

Is there a possibility to tell Enterprise architect to ignore the keyword extern "C"?

Thank's a lot!!!

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Reverse Engineering C++ - extern
« Reply #1 on: May 01, 2015, 10:10:53 am »
I wouldn't have thought a class would be valid inside an extern "C" because it's not C compatible. So the C compiler would have to be aware of C++ syntax.

If it is valid, I'm not sure what it would mean. The extern "C" means that C calling conventions should be used. It may be able to work out basic classes, but overloaded methods certainly couldn't be called.
« Last Edit: May 01, 2015, 10:15:24 am by simonm »