[python-win32] How do I build manifest-less extension modules?

Will Sadkin wsadkin at ParlanceCorp.com
Fri Aug 5 18:07:31 CEST 2011


Thanks, Mark;

Unfortunately, that did not work for me.  I still get:

C:\Program Files (x86)\Python2.7>python.exe
Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', 'C:\\Windows\\system32\\python27.zip', 'C:\\Program Files
(x86)\\Python2.7\\DLLs', 'C:\\Program Files (x86)\\Python2.7\\lib',
'C:\\Program Files (x86)\\Python2.7\\lib\\plat-win', 'C:\\Program Files
(x86)\\Python2.7\\lib\\lib-tk', 'C:\\Program Files (x86)\\Python2.7',
'C:\\Program Files (x86)\\Python2.7\\lib\\site-packages', 'C:\\Program
Files (x86)\\Python2.7\\lib\\site-packages\\win32', 'C:\\Program Files
(x86)\\Python2.7\\lib\\site-packages\\win32\\lib', 'C:\\Program Files
(x86)\\Python2.7\\lib\\site-packages\\Pythonwin', 'C:\\Program Files
(x86)\\Python2.7\\lib\\site-packages\\wx-2.8-msw-unicode']
>>> import pyodbc
>>> pyodbc
<module 'pyodbc' from 'C:\Program Files
(x86)\Python2.7\lib\site-packages\pyodbc.pyd'>
>>> import PyNCSWrappers
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: DLL load failed: The specified module could not be found.
>>>

My linker command line is now:

/OUT:"Release/PyNCSWrappers.pyd" /INCREMENTAL:NO /NOLOGO
/LIBPATH:"..\..\..\lib\i86nt\Python" /DLL
"..\common\Release\TRoutLib.lib"
"C:\p4clients\wss\main\ncs\src\lib\butils\Release\builderutils.lib"
"C:\p4clients\wss\main\ncs\src\lib\common\Release\TRoutLib.lib"
"C:\p4clients\wss\main\ncs\src\lib\PhoneNum\Release\PhoneNumLib.lib"
"C:\p4clients\wss\main\ncs\src\lib\Py2CLib\Release\Py2CLib.lib"
"C:\p4clients\wss\main\ncs\src\lib\Registry\Release\RegLib.lib"
/MANIFEST:NO /ALLOWISOLATION /MANIFESTUAC:NO /DEBUG
/PDB:".\Release/PyNCSWrappers.pdb"
/PGD:"C:\p4clients\wss\main\ncs\src\lib\PyNCSWrappers\Release\PyNCSWrapp
ers.pgd" /TLBID:1 /DYNAMICBASE:NO /IMPLIB:".\Release/PyNCSWrappers.lib"
/MACHINE:X86 /ERRORREPORT:QUEUE

When this alone didn't work, I also set and linked the dependent dlls to
also not use manifests using the same /MANIFEST:NO option, and copied
these into the same location as the .pyd (lib/site-packages), but this
did nothing to change the behavior.  Is there any way I can get a more
detailed explanation of why/which dll load failed?   As it is, I'm
somewhat at a loss for a "next step"...

Thanks in advance,
/Will

-----Original Message-----
From: Mark Hammond [mailto:skippy.hammond at gmail.com] 
Sent: Thursday, August 04, 2011 9:03 PM
To: Will Sadkin
Cc: python-win32 at python.org
Subject: Re: [python-win32] How do I build manifest-less extension
modules?

On 4/08/2011 7:24 AM, Will Sadkin wrote:
> So...
> Can someone tell me how to build our .pyd in VS2010 such that it 
> doesn't have a manifest, and thus can be loaded by the Python2.7
interpreter?

You should be able to use the cmdline option MANIFEST:NO to the linker -
that is what pywin32 does.

> PS: Is there any growing pressure to make Python compatible with the 
> latest compiler from Microsoft, now almost 2 years old?!?

Not really - there is a bit of a history of skipping every second
release.  The main problem is friction for extension authors targetting
multiple Python versions and thereby forcing them to update their tool
chain.  This is slightly less of a problem if the free tools are used
but still a PITA for people who need to use features not available in
the free version.

As I understand it though, some of the manifest pain should go away with
VS2010, so this could be a compelling reason for Python 3.3 - it's
almost certainly not an option for anything already released using
VC2008 (ie, I expect we will never see a VS2010 version of 2.7)

Cheers,

Mark


More information about the python-win32 mailing list