Ecere SDK/eC Forums • View topic - Compatibility with C




Ecere SDK/eC Forums

Ecere Developers Community

Compatibility with C

Forum for talking about anything else Ecere/eC related.

Compatibility with C

Postby jonaspm » Tue Jun 04, 2013 8:23 pm

I got a question:
Is Ecere 100% compatible with C?

thanks in advance
jonaspm
 
Posts: 49
Joined: Thu Apr 11, 2013 11:04 pm
Location: Mexico

Re: Compatibility with C

Postby jerome » Tue Jun 04, 2013 8:33 pm

Hi Jonas,

eC aims to be a superset of C, being as compatible with C as possible while keeping a neat syntax.
I'd say it's 99% C compatible.
Examples of things that are not fully C compatible:

- C code that would use reserved eC keywords, e.g. 'property', 'class'
(A work around to include C headers that use this is to #define, #include, and #undef)
- C style structs and typedefs -- eC tries to handle both eC style structs that define a type without using a typedef, and C style structs. There maybe some border-line cases however where there is ambiguity and eC's understanding will prevail.
- There may still be some bugs and limitations in the compiler where compatibility would in effect be broken.

In an eC project, you can mix and match eC, C and C++ files.

eC will export symbols just like C would (unmangled), unless you are using the eC namespaces (the namespace will mangle the symbols).

Please let me know if you have more specific questions regarding this!

Regards,

Jerome
jerome
Site Admin
 
Posts: 622
Joined: Sat Jan 16, 2010 11:16 pm

Re: Compatibility with C

Postby jonaspm » Tue Jun 04, 2013 9:38 pm

thank you so much for the quick and complete answer Jerome :D
jonaspm
 
Posts: 49
Joined: Thu Apr 11, 2013 11:04 pm
Location: Mexico

Re: Compatibility with C

Postby jerome » Wed Jun 05, 2013 7:59 am

I forgot to mention, eC has 4 declaration modes:

private: Things are visible inside the library/exe only.
public: Things are visible to libraries and executables importing this library.
static: Things are visible only inside this source file.
default: C compatibility mode

By default eC is in private mode.
But anything included from a .h header is automatically in default (C compatibility mode).

In this mode there is no ambiguity with the C style structs, they will always be understood as C structs. To write a header that defaults to eC style private mode, use the .eh extension instead. But there is rarely a need for writing headers in eC, as the import mechanism works very well.

Basically there should not be any issue including headers for and linking with a C library, or in fact any library that exposes C bindings. If you come across a library that you're having trouble with, I will be happy to help you resolve it. But then the Ecere library comes loaded with functionality, so a lot is already covered!

Regards,

Jerome
jerome
Site Admin
 
Posts: 622
Joined: Sat Jan 16, 2010 11:16 pm

Re: Compatibility with C

Postby jonaspm » Wed Jun 05, 2013 8:10 pm

Thank You!!!
jonaspm
 
Posts: 49
Joined: Thu Apr 11, 2013 11:04 pm
Location: Mexico


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron