Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>(Sorry, I did a stupid thing, I first wrote the question, and then registered, and now I cannot alter it or comment on the replies, because StackOverflow's engine doesn't think I'm the author. I cannot even properly thank those who replied :( So this is actually an update to the question and comments.)</p> <p>Thanks for all the advice, it's very valuable. As far as I understand with some effort I can link Python statically into a custom DLL, provided that I compile other dynamically loaded extensions myself and link them against the same DLL. (I know I need to ship the standard library too; my plan was to append a zipped archive to the DLL file. As far as I understand, I will even be able to import pure Python modules from it.)</p> <p>I also found an interesting place in <code>dynload_win.c</code>. (I understand it loads dynamic extensions that use Python C API, e.g. <code>_ctypes</code>.) As far as I can see it not only looks for <code>init_ctypes</code> symbol or whatever the extension name is, but also scans the <code>.pyd</code> file's import table looking for (regex) <code>python\d+\.</code> and then compares the found symbol with known <code>pythonNN.</code> string to make sure the extension was compiled for this version of Python. If the import table doesn't have such a symbol or it refers to another version, it raises an error. </p> <p>For me it means that:</p> <ul> <li>If I link an extension against <code>pythonNN.dll</code> and try to load it from my custom DLL that includes a statically linked Python, it will pass the check, but — well, here I'm not sure: will it fail because there's no <code>pythonNN.dll</code> (i.e. even before getting to the check) or it will happily load the symbols?</li> <li>And if I link it against my custom DLL, it will find symbols, but won't pass the check :)</li> </ul> <p>I guess I could rewrite this piece to suit my needs... Are there any other such places, I wonder.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload