[Bf-python] compile a native c extension for python with msvc 2013

Michel Anders Michel.Anders at inter.nl.net
Sun Apr 13 11:54:26 CEST 2014


 

Solved: it helps if you compile for the x64 platform  (the example solution only contains win32 configurations and I think this choice not only affects the generated code but also the name mangling used to generate decorated names in the .dll, hence the linker errors)

 

I should’ve looked better :-/

 

BTW: the /export:initexample switch is wrong: there is no need to explicitly export anything (the PyMODINIT_FUNC macro takes care of that) and although the python docs state otherwise, the module initialization function should be called PyInit_xxxxxx (as it is in the ectuall example code) and NOT initxxxxxxx (as stated in the accompanying text).

 

Cheers,

 

-- Michel.

 

From: bf-python-bounces at blender.org [mailto:bf-python-bounces at blender.org] On Behalf Of Michel Anders
Sent: zaterdag 12 april 2014 20:28
To: 'Blender Foundation Python list'
Subject: [Bf-python] compile a native c extension for python with msvc 2013

 

Hi,

 

Did anyone have any luck in compiling the example_nt extension from the python source distribution w. msvc 2013?

 

I copied it into  lib\win64_vc12\python, opened the solution in msvc 2013 and after pointing the include directories and library directories o the ones in the same python lib it compiles ok but complains about not being able to find initexample although there is an /export:initexample defined in the properties. Anyone have a clue?

 

Cheers,

 

-- Michel.

 

1>------ Build started: Project: example, Configuration: Debug Win32 ------

1>  example.c

1>e:\blender source environment\lib\win64_vc12\python\include\python3.3\pymath.h(22): warning C4273: 'round' : inconsistent dll linkage

1>          e:\visual studio 2013\vc\include\math.h(516) : see previous definition of 'round'

1>example.obj : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/OPT:LBR' specification

1>LINK : error LNK2001: unresolved external symbol initexample

1>.\Debug/example_d.lib : fatal error LNK1120: 1 unresolved externals

========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20140413/0146ff1a/attachment.html>


More information about the Bf-python mailing list