MinGW Create Application C LIB

 

- Info:

- This tutorial shows how to use MinGW and C to create Static Library LIB.

- This tutorial is based on http://www.cygwin.com/cygwin-ug-net/dll.html

 

- Procedure:

- Creata C:\Temp\Test.h, Test.c and Hello.c

- Start MSDOS

- gcc -c Test.c -o message.lib

- gcc -static Hello.c -L./ -lmessage -o hello.exe

- hello.exe

 

Test.h

void hello(void);

Test.c

#include <stdio.h>

#include "Test.h"

void hello(void) { printf("Hello from LIB!\n"); }

 

Hello.c

int main () {

hello();

return 0;

}