static/dynamic libraries

BlitzMax Forums/BlitzMax Programming/static/dynamic libraries

1. create a myname.mod/mymod.mod folder in your blitzmax/mod folder

2. copy your c source and headers into that folder retaining their folder structure

3. create a mymod.bmx file in the mymod.mod folder and add the following:
Module myname.mymod

Strict

Import "mycfile1.c"
Import "mycfile2.c"

4. Makemods and make sure GCC can build the C files OK, the path to myname.mod/mymod.mod is added to the include path so any #include <file.h>'s can be found, if you get this far, cool, thats the traditional makefile script side of things done.

5. Add an Extern block to your mymod.bmx, and place any functions you want to call from BlitzMax here, start with one, and if the functions are defined in C++ make sure they are declared in an Extern "C" {} block in the header file.

If you get stuck you may want to study the modules in pub to see how we do things.