Blender as a Python module

Hi guys,

I’m just a little bit desperated and I really hope I can get some hints for solving my (basic!!) problem. I really read a lot of different tutorials how to get the “bpd.pyd” document for getting Blender as a Python module to write in a Python Shell ’ import Blender ', but I couldnt follow or with mingw32 I couldnt get anything (just a datatoc.exe).

I have a windows 7 (64bit) , Cmake and Mingw32. I got the source of Blender with TortoiseSVN. Then I build with Cmake my files for Mingw. And then I’m trying to get my bpd.pyd through compiling with the command line:

C:…\build_mingw > mingw32-make

And I got some compiling, mostly till 33% …

and afterwards sth like this:

C…\blender\source\blender\blenlib\intern\winstuff.c:155:2: error: implicit declaration of function ‘IsWow64Process’ [-Werror=implicit-function-declaration]
IsWow64Process(GetCurrentProcess(), &IsWOW64);
In file included from C:…\blender\source\blender\blenlib\intern\winstuff.c:44:0:
c:…\blender\source\blender\blenlib\intern\winstuff.c: At top level: C:…\blender\source\blender\blenlib\BLI_utildefines.h:340:58: warning: ‘UNUSED_BLI_alloc_utf16_from_8’ defined but not used [-Wunused-function]

deine UNUSED_FUNCTION(x) attribute((unused)) UNUSED_## x

C:…\blender\source\blender\blenlib\intern\winstuff.c:207:17: note: in expansion of macro ‘UNUSED_FUNCTION’
static wchar_t *UNUSED_FUNCTION(BLI_alloc_utf16_from_8) (chair *in8, size_t add)

cc1.exe: some warnings being treated as errors
source\blender\blenlib\CMakeFiles\bf_blenlib.dir\build.make:1497: recipe for target ‘source\blender\blenlib\CMakeFiles\bf_blenlib.dir\intern\winstuff.c.obj’ failed
mingw32-make[2]: *** [source\blender\blenlib\CMakeFiles\bf_blenlib.dir\intern\winstuff.c.obj] Error 1
CMakeFiles\Makefile2:2334: recipe for target ‘source\blender\blenlib\CMakeFiles\bf_blenlib.dir\all’ failed
mingw32-make[1]: *** [source\blender\blenlib\CMakeFiles\bf_blenlib.dir\all] Error 2
Makefile:145: recipe for target ‘all’ failed
mingw32-make: *** [all] Error 2

Does anyone has an idea what’s wrong there?
I really just want to have this Blender Python module.

Thank you all very much for your answers!!!
Schnettchen

What cmake flags are you using?

I changed the default with:
WITH_PLAYER=OFF
WITH_PYTHON_MODULE=ON
WITH_PYTHON_INSTALL=OFF

Thanks for helping

the problem comes from complied Win32 API library mismatching for MINGW32 GCC compiler.
Old Win32 API has that, but new one doesn’t have it, then just comment out.