Ecere SDK/eC Forums https://ec-lang.org/community/ Print view |
|
Compatibility with C https://ec-lang.org/community/viewtopic.php?f=26&t=362 |
Page 1 of 1 |
Author: | jonaspm [ Tue Jun 04, 2013 8:23 pm ] |
Post subject: | Compatibility with C |
I got a question: Is Ecere 100% compatible with C? thanks in advance |
Author: | jerome [ Tue Jun 04, 2013 8:33 pm ] |
Post subject: | Re: Compatibility with C |
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 |
Author: | jonaspm [ Tue Jun 04, 2013 9:38 pm ] |
Post subject: | Re: Compatibility with C |
thank you so much for the quick and complete answer Jerome |
Author: | jerome [ Wed Jun 05, 2013 7:59 am ] |
Post subject: | Re: Compatibility with C |
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 |
Author: | jonaspm [ Wed Jun 05, 2013 8:10 pm ] |
Post subject: | Re: Compatibility with C |
Thank You!!! |
All times are UTC-05:00 | Page 1 of 1 |
Powered by phpBB® Forum Software © phpBB Limited |