I prepared an eC project (see attachment) to clearly show how this is done.I will be using Ecere both the Language and SDK with this group but I will also need to see how to be able to call external static or DLL C library from Ecere (static is more important), just in case the need arise.
There is a second project for a sample C library (consisting of a single function).
Both projects have the regular Debug and Release project configurations, which use shared libraries (DLLs), and an additional configuration called 'Static' creating and linking in the static C library.
A few preprocessor definitions are defined in the Win32 project to control how the functions are exported and imported from the C library: USE_DLLEXPORT, USE_DLLIMPORT, USE_STDCALL.
USE_DLLEXPORT is defined when building the shared library, while USE_DLLIMPORT is defined when linking with it. USE_STDCALL is defined to standardize the function name mangling and calling convention ( a typical practice with Windows DLLs to use them across different compilers ).
As you can see, there is very little to using a library. You simply use #include to include the C library header (note: you can run into some conflicts doing this, where using #define / #undef can help, ask for help if you run into this).
Then you need sure the path to your C headers are included in your 'Additional include directories', within 'Project Settings / Compiler Settings'.
Then you add the name of the library to the 'Additional libraries' in Project Settings / Linker Settings, as well as the path to the built library (.lib or .dll for dynamic, .a for static) in 'Additional library directories'. Note that static library built with/for MinGW will always be preceded by the 'lib' prefix. That lib prefix should not be included when adding it to the 'Additional libraries' line: e.g. cLibrary even though the static library is libcLibrary.a .
For MSVC libraries (.lib), the full name should be included even if they are static libraries.
The attached zip file contains the projects as well as the built executables and workspace.
You can see in the eCproject workspace that the cLibrary project was added to the workspace as well. This will allow the IDE to automatically find and use the proper configuration DLL when debugging or running the application (even though it is located in a separate folder).
Let me know if you have any further questions about this!
Cheers,
Jerome