How to create a dynamic library in C language and connect it to a C project using the Cygwin / gcc compiler in the command line?
So I did and connected (the code below) with the prefix lib and the extension .so, but tell me how about the extension .dll . Thank.
sum.c
#include "sum.h" int f1(int a, int b) { return a + b; } sum.h
int f1(int, int); main.c
#include <stdio.h> #include "sum.h" int main(void) { printf("%d", f1(10, 20)); getchar(); return 0; } creating a dynamic library
gcc -shared sum.c -o libsum.so
compiling a project with a dynamic library
gcc main.c -o abc.exe -L. libsum.so