Compiling DLL's
  DLL Help. by SirDude 
 

Making Dll's under Windows

There are couple of options for creating dll's under windows. Here are two options.

  • Compiling using lcc

    Its very easy using the command line options to lcc. Assuming you have your plugins in c:\blender\plugins. Here is an example of how you would compile the sequence plugin sweep.c Open a dos prompt and do one of the following: (Note: You'll want to make sure the lcc\bin dir is in your path)

    If your using a version of lcc that comes with implib do the following:

     cd c:\blender\plugins\sequence\sweep
     lcc -Ic:\blender\plugins\include sweep.c
     lcclnk -DLL sweep.obj c:\blender\plugins\include\seq.def
     implib sweep.dll
    
    If your using a version that does not have implib try this:
    lcc -O -Ic:\blender\plugins\include sweep.dll sweep.c
    lcclnk -dll -nounderscores sweep.obj c:\blender\plugins\include\seq.def
    
  • Compiling using MinGW That comes with dev-c++
    gcc -I. -g -Wall -c -o sweep.o sweep.c
    dllwrap -I. --export-all --output-def sweep.def -o sweep.dll -lm
    

If you are compling a texture you want tex.def not seq.def

If you have perl installed you can run makedll.pl which will build them all for you.

(seq.def, tex.def and makedll.pl are included in the plugin source downloads on this site they do not currently come with blender.)

You may also want to add -funsigned-char to your compile options...

If your getting errors about Random #'s and what not try doing the following:

add  this line after the other includes:
#include "stdio.h"
then replace all random() calls by rand()

There is also a link to using lcc's gui to compile a plugin:
http://paladium.topcities.com/lcc.htm

The views and opinions expressed in this page are strictly those of the page author.
The contents of this page have not been reviewed or approved by the University of Minnesota.