[issue24429] msvcrt error when embedded

2020-12-01 Thread Irit Katriel
Irit Katriel added the comment: This is a python 2.7-only issue. -- nosy: +iritkatriel resolution: -> out of date stage: -> resolved status: open -> closed ___ Python tracker __

[issue24429] msvcrt error when embedded

2015-07-14 Thread eryksun
eryksun added the comment: > windll.python27._Py_ActivateActCtx would suffice It would instead be ctypes.pythonapi._Py_ActivateActCtx -- if the DLL exported a function with this name. ctypes.pythonapi is a PyDLL instance that wraps sys.dllhandle. I think it would be more useful in general t

[issue24429] msvcrt error when embedded

2015-06-18 Thread Steve Dower
Steve Dower added the comment: > Steve, since you haven't closed this issue, have you considered my suggestion > to export _Py_ActivateActCtx and _Py_DeactivateActCtx for use by C extensions > such as _ctypes.pyd? These functions are better than manually creating a > context from the manifest

[issue24429] msvcrt error when embedded

2015-06-18 Thread eryksun
eryksun added the comment: > shapely's installation instructions from windows are to use > chris gohlke's prebuilt binaries from here: > http://www.lfd.uci.edu/~gohlke/pythonlibs/ Christoph Gohlke's Shapely‑1.5.9‑cp27‑none‑win_amd64.whl includes a version of geos_c.dll that has the VC90 manif

[issue24429] msvcrt error when embedded

2015-06-16 Thread Steve Dower
Steve Dower added the comment: > i assume he's coordinating the crt versions? apparently a lot of people use > these. So do I :) He's definitely got access to the correct compiler versions, so I'm sure he's using them (via distutils/setuptools, which will always try to use the correct one).

[issue24429] msvcrt error when embedded

2015-06-16 Thread erik flister
erik flister added the comment: thanks a lot for the detailed info steve, very clearly stated! > Yeah, geos_c.dll really should have exported its own free() function. > find_library('c') is probably the wrong approach here - if geos_c.dll is > being rebuilt with different CRTs at all then the

[issue24429] msvcrt error when embedded

2015-06-15 Thread Steve Dower
Steve Dower added the comment: > python-3.5b2 is linked against the newly introduced 'universal CRT', that is > without any doubt a SYSTEM LIBRARY. However, heap memory managment functions > and other functions are linked against VCRUNTIME140.dll instead of the > ucrtbase.dll. Is this the inte

[issue24429] msvcrt error when embedded

2015-06-15 Thread Carl Kleffner
Carl Kleffner added the comment: > Windows itself is the primary user of msvcrt.dll. > A Windows 7 installation has over 1500 DLLs and over > 350 executables in System32 that depend on msvcrt.dll. > Windows developers such as Raymond Chen get a bit annoyed > when projects link directly with m

[issue24429] msvcrt error when embedded

2015-06-14 Thread eryksun
eryksun added the comment: >> python's DLL already has the necessary "complete manifest," right? > > In theory yes, but apparently it isn't working in this case. It > needs more investigation to figure out why. The manifest in the DLL is stored as resource ID 2. This secondary manifest is used

[issue24429] msvcrt error when embedded

2015-06-13 Thread Steve Dower
Steve Dower added the comment: > i'm not following why it's a special case, or why later versions wouldn't > have the same problem? The Microsoft C Runtime 9.0 required an activation context to allow multiple versions to load side by side. This turned out to be more trouble than it was worth,

[issue24429] msvcrt error when embedded

2015-06-13 Thread erik flister
erik flister added the comment: > About the only possible solution here would be to special case ctypes to > detect msvcr90 as a parameter (later versions of the CRT don't need it) and > also whether another activation context already exists. We could also > document the need for a complete ma

[issue24429] msvcrt error when embedded

2015-06-13 Thread Steve Dower
Steve Dower added the comment: About the only possible solution here would be to special case ctypes to detect msvcr90 as a parameter (later versions of the CRT don't need it) and also whether another activation context already exists. We could also document the need for a complete manifest in

[issue24429] msvcrt error when embedded

2015-06-12 Thread erik flister
erik flister added the comment: well i can confirm @eryksun's method works, so it's not a problem with how the manifest is included in the dll. to me, the real issue is that ctypes.cdll.msvcrt and find_library('c') aren't correct. the first returns something "old and unsupported," or "offici

[issue24429] msvcrt error when embedded

2015-06-11 Thread erik flister
erik flister added the comment: relevant: http://stackoverflow.com/questions/30771380/how-use-ctypes-with-msvc-dll-from-within-matlab-on-windows/#comment49619037_30771380 -- ___ Python tracker

[issue24429] msvcrt error when embedded

2015-06-11 Thread Steve Dower
Steve Dower added the comment: Ah, it can go into the DLL, and it's already there. The problem may be that there is conflicting information about which resource ID - https://msdn.microsoft.com/en-us/library/aa374224(v=vs.90).aspx says it should be 1 while your link says 2. python27.dll has th

[issue24429] msvcrt error when embedded

2015-06-11 Thread erik flister
erik flister added the comment: if it can't go into your .dll, what are libraries like shapely supposed to do? tell their users to do all this manifest stuff if they're running embedded? -- ___ Python tracker ___

[issue24429] msvcrt error when embedded

2015-06-11 Thread erik flister
erik flister added the comment: am i reading this wrong, that you can put the manifest into the .dll? https://msdn.microsoft.com/en-us/library/ms235560(v=vs.90).aspx -- ___ Python tracker __

[issue24429] msvcrt error when embedded

2015-06-11 Thread Steve Dower
Steve Dower added the comment: python.exe already has the manifest it needs, but it can't be embedded into python27.dll - it has to go into the exe file. That's why Python can't make it so that msvcr90.dll is loaded. Depending on what you're using it for, the C Runtime may keep some state in

[issue24429] msvcrt error when embedded

2015-06-11 Thread erik flister
erik flister added the comment: thanks - i still don't understand tho. if python would have to be recompiled to use a different crt, why wouldn't matlab? if a manifest could fix matlab, why couldn't one fix python? i ran into all this trying to get shapely to load in matlab, and using msvcrt

[issue24429] msvcrt error when embedded

2015-06-11 Thread Steve Dower
Steve Dower added the comment: Python needs to be recompiled to use a different CRT, and that will break all existing extension modules (.pyd's). That said, in some situations it is the right answer, typically because existing extension modules would be broken anyway, but I don't think that ap

[issue24429] msvcrt error when embedded

2015-06-11 Thread erik flister
erik flister added the comment: > it would be better for MATLAB to embed the manifest in their host executable > if they're going to load the DLL directly. can you help me understand? as far as i could tell, we need python to use the msvcr*.dll that comes with matlab, not v/v. it's hard (as

[issue24429] msvcrt error when embedded

2015-06-11 Thread Steve Dower
Steve Dower added the comment: msvcrt isn't the right version, it just happens to load. It's actually an old, basically unsupported version. The problem would seem to be that Python 2.7 does not activate its activation context before loading msvcrt90 via ctypes. Eryksun (nosied - hope you're t

[issue24429] msvcrt error when embedded

2015-06-11 Thread erik flister
New submission from erik flister: normally, CDLL(find_library('c')) is fine. but when running embedded in a context that uses a different runtime version, this will cause an error (example: http://stackoverflow.com/questions/30771380/how-use-ctypes-with-msvc-dll-from-within-matlab-on-windows/