{"id":302542,"date":"2020-04-26T21:00:27","date_gmt":"2020-04-26T21:00:27","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=302542"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=302542","title":{"rendered":"DLL &amp; Python"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/499152\/\">\n<h1 id=\"dll--python\">DLL &amp; Python<\/h1>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/kd\/c5\/he\/kdc5hec_pw95siaqzue5_ob099c.png\" alt=\"image\"\/><\/p>\n<p>  <\/p>\n<p>\u041d\u0435\u0434\u0430\u0432\u043d\u043e \u043c\u0435\u043d\u044f \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043b\u0430 \u0442\u0435\u043c\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f DLL \u0438\u0437 Python. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e \u0431\u044b\u043b\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u0438\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435, \u043d\u0430 \u0442\u043e\u0442 \u0441\u043b\u0443\u0447\u0430\u0439, \u0435\u0441\u043b\u0438 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043c\u0435\u043d\u044f\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a. \u041f\u043e\u0441\u043b\u0435 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u043d\u0430 \u044d\u0442\u0443 \u0442\u0435\u043c\u0443, \u0441\u0442\u0430\u043b\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u043c\u043e\u0436\u0435\u0442 \u0441\u0438\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 Python. \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0446\u0435\u043b\u0438 \u0431\u044b\u043b\u0438 \u0434\u043e\u0441\u0442\u0438\u0433\u043d\u0443\u0442\u044b, \u0430 \u0447\u0442\u043e\u0431\u044b \u043e\u043f\u044b\u0442 \u043d\u0435 \u0431\u044b\u043b \u0437\u0430\u0431\u044b\u0442, \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0434\u0432\u0435\u0441\u0442\u0438 \u0438\u0442\u043e\u0433 \u0432 \u0432\u0438\u0434\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u2014 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0437\u043d\u0430\u043d\u0438\u044f \u0438 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438, \u0430 \u0437\u0430\u043e\u0434\u043d\u043e \u0435\u0449\u0451 \u043b\u0443\u0447\u0448\u0435 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0442\u0435\u043c\u0435.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c \u0432\u0430\u0441 \u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u0441\u0442\u0430\u0442\u044c\u044f \u0441 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438, \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u043c\u0438 \u0438 \u043f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u044f\u043c\u0438 \u043a \u043d\u0438\u043c.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h4 id=\"soderzhanie\">\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435<\/h4>\n<p>  <\/p>\n<ul>\n<li>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 DLL<\/li>\n<li>DLL &amp; Python<br \/> \n<ul>\n<li>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 DLL<\/li>\n<li>\u0422\u0438\u043f\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0421 \u0438 Python<\/li>\n<li>\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f<\/li>\n<li>\u0421\u0432\u043e\u044f DLL \u0438 \u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435<\/li>\n<\/ul>\n<\/li>\n<li>\u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438:<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041d\u0430\u0434\u0435\u044e\u0441\u044c \u0438\u0437 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u0442\u0430\u043d\u0435\u0442 \u043f\u043e\u043d\u044f\u0442\u043d\u0435\u0435 \u043a\u0430\u043a\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 \u043e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u0441\u0432\u043e\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u044b.<\/p>\n<p>  <\/p>\n<h2 id=\"struktura-dll\">\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 DLL<\/h2>\n<p>  <\/p>\n<p>DLL \u2014 <em>Dynamic Link Library<\/em> \u2014 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0432 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 (\u041e\u0421) Windows. \u0414\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443 \u0431\u043e\u043b\u0435\u0435 \u043c\u043e\u0434\u0443\u043b\u044c\u043d\u043e\u0439, \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0438 \u0443\u043f\u0440\u043e\u0449\u0430\u044e\u0442 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u044b. \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 .EXE \u0444\u0430\u0439\u043b\u043e\u0432 \u2014 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0435\u0441\u044f \u0432 DLL \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e \u043e\u0434\u043d\u043e\u0439.<\/p>\n<p>  <\/p>\n<p>\u0423\u0447\u0438\u0442\u044b\u0432\u0430\u044f, \u0447\u0442\u043e \u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0435 \u043e \u0441\u0430\u043c\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u0445, \u043b\u0443\u0447\u0448\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0437\u0434\u0435\u0441\u044c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0432\u043d\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e \u043e\u0442 Microsoft: <a href=\"https:\/\/support.microsoft.com\/ru-ru\/help\/815065\/what-is-a-dll\">\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 DLL?<\/a>.<\/p>\n<p>  <\/p>\n<hr\/>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c, \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u043d\u0443\u0436\u043d\u043e \u0432\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u0432 \u0438\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443. <\/p>\n<p>  <\/p>\n<p>DLL \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0430\u0431\u043e\u0440 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0442\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e-\u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u041d\u043e \u0442\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c <strong><em>\u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0442\u043e\u0447\u043a\u0438 \u0432\u0445\u043e\u0434\u0430<\/em><\/strong> \u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443. \u0422\u0430\u043a\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0438\u043c\u0435\u0435\u0442 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0438\u043c\u044f <code>DllMain<\/code> \u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0438\u043b\u0438 \u043f\u043e\u0442\u043e\u043a\u0438 \u043f\u0440\u0438\u043a\u0440\u0435\u043f\u043b\u044f\u044e\u0442\u0441\u044f \u043a DLL \u0438\u043b\u0438 \u043e\u0442\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u0442 \u043d\u0435\u0451. \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u043b\u0438 \u0438\u0445 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/kn\/zc\/wb\/knzcwb3x2yta0j9giribq0iyxlc.png\"\/>  <\/p>\n<p><em>\u0420\u0438\u0441\u0443\u043d\u043e\u043a 1 \u2014 \u041f\u0443\u0441\u0442\u043e\u0439 template, \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u043c\u044b\u0439 Code Blocks \u0434\u043b\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430 DLL.<\/em><\/p>\n<p>  <\/p>\n<p>\u041d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435 1 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u0448\u0430\u0431\u043b\u043e\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 Code Blocks, \u043f\u0440\u0438 \u0432\u044b\u0431\u043e\u0440\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0442\u0438\u043f\u0430 DLL. \u0412 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u043c \u0448\u0430\u0431\u043b\u043e\u043d\u0435 \u0435\u0441\u0442\u044c \u0434\u0432\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">#define DLL_EXPORT __declspec(dllexport) \/\/ \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438,                                           \/\/ \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0438\u0437                                                 \/\/ \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 void DLL_EXPORT SomeFunction(const LPCSTR sometext); \/\/ \u043f\u0440\u043e\u0441\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430, \u043e\u043d\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0432\u044b\u0432\u043e\u0434 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0432 \u043e\u043a\u043d\u043e<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"cpp\">extern &quot;C&quot; DLL_EXPORT BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) \/\/\u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0442\u043e\u0447\u043a\u0438 \u0432\u0445\u043e\u0434\u0430<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u0442\u043e\u0438\u0442 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e<code>DllMain<\/code>. \u0427\u0435\u0440\u0435\u0437 \u043d\u0435\u0435 \u041e\u0421 \u043c\u043e\u0436\u0435\u0442 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u044f\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u043e\u0431\u044b\u0442\u0438\u044f\u0445 (<em>fdwReason<\/em>):<\/p>\n<p>  <\/p>\n<ul>\n<li>\n<p><strong>DLL_PROCESS_ATTACH<\/strong> \u2013 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 DLL. \u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u0440\u043e\u0435\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f DLL \u043d\u0430 \u0430\u0434\u0440\u0435\u0441\u043d\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430. \u0421 \u044d\u0442\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c DllMain \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u0441\u044f\u043a\u0438\u0439 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0441 \u044f\u0432\u043d\u043e\u0439 \u0438\u043b\u0438 \u043d\u0435\u044f\u0432\u043d\u043e\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u043a\u043e\u0439.<\/p>\n<p>  <\/li>\n<li>\n<p><strong>DLL_PROCESS_DETACH<\/strong> \u2013 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 DLL \u043e\u0442 \u0430\u0434\u0440\u0435\u0441\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430. \u0421 \u044d\u0442\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c DllMain \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438. <\/p>\n<p>  <\/li>\n<li>\n<p><strong>DLL_THREAD_ATTACH<\/strong> \u2013 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0432\u0448\u0438\u043c DLL, \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430. \u0417\u0430\u0447\u0435\u043c DLL \u0437\u043d\u0430\u0442\u044c \u043e \u043a\u0430\u043a\u0438\u0445-\u0442\u043e \u0442\u0430\u043c \u043f\u043e\u0442\u043e\u043a\u0430\u0445? \u0410 \u0432\u043e\u0442 \u0437\u0430\u0447\u0435\u043c, \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u043a\u0430\u0436\u0434\u0430\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0439 \u0441\u0440\u0435\u0434\u0435.<\/p>\n<p>  <\/li>\n<li>\n<p><strong>DLL_THREAD_DETACH<\/strong> \u2013 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u043f\u043e\u0442\u043e\u043a\u0430, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0432\u0448\u0438\u043c DLL. \u0415\u0441\u043b\u0438 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430 \u0441\u0432\u043e\u0438 &quot;\u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0435&quot; \u0440\u0435\u0441\u0443\u0440\u0441\u044b (\u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0438 \u0431\u0443\u0444\u0435\u0440\u0430), \u0442\u043e \u044d\u0442\u043e \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0445 \u0441\u0432\u043e\u0435\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0442\u044c.<\/p>\n<p>  <\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041e\u043f\u044f\u0442\u044c \u0436\u0435, \u0432 \u0442\u0435\u043c\u0443 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b DLL \u043c\u043e\u0436\u043d\u043e \u0443\u0433\u043b\u0443\u0431\u043b\u044f\u0442\u044c\u0441\u044f \u0434\u043e \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0441\u0442\u0438, \u0442\u0430\u043c \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043d\u044e\u0430\u043d\u0441\u043e\u0432, \u043e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0438\u0437\u043b\u043e\u0436\u0435\u043d\u043e \u0432 \u044d\u0442\u043e\u0439 <a href=\"http:\/\/citforum.ru\/book\/cook\/dll1.shtml\">\u0441\u0442\u0430\u0442\u044c\u0435<\/a>. <\/p>\n<p>  <\/p>\n<hr\/>\n<p>  <\/p>\n<p>\u0423 <code>DllMain<\/code> \u043d\u0435 \u0442\u0430\u043a \u043c\u043d\u043e\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u0441\u0430\u043c\u044b\u0439 \u0432\u0430\u0436\u043d\u044b\u0439 <code>fdwReason<\/code> \u0443\u0436\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d \u0432\u044b\u0448\u0435, \u0442\u0435\u043f\u0435\u0440\u044c \u043e \u0434\u0432\u0443\u0445 \u0434\u0440\u0443\u0433\u0438\u0445:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 <strong>lpvReserved<\/strong> \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f DLL:<br \/> \n<ul>\n<li>0 \u2014 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u0430 \u0441 \u044f\u0432\u043d\u043e\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u043a\u043e\u0439. <\/li>\n<li>1 \u2014 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u0430 \u0441 \u043d\u0435\u044f\u0432\u043d\u043e\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u043a\u043e\u0439.<\/li>\n<\/ul>\n<\/li>\n<li>\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 <strong>hinstDLL<\/strong> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u043f\u0438\u0441\u0430\u0442\u0435\u043b\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 DLL. \u041b\u044e\u0431\u043e\u043c\u0443 EXE- \u0438\u043b\u0438 DLL-\u043c\u043e\u0434\u0443\u043b\u044e, \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c\u043e\u043c\u0443 \u0432 \u0430\u0434\u0440\u0435\u0441\u043d\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430, \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043e\u043f\u0438\u0441\u0430\u0442\u0435\u043b\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430. <\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041e \u044f\u0432\u043d\u043e\u0439 \u0438 \u043d\u0435\u044f\u0432\u043d\u043e\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u043a\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0435\u0441\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0432 \u0441\u0442\u0430\u0442\u044c\u0435: <a href=\"https:\/\/docs.microsoft.com\/ru-ru\/cpp\/build\/linking-an-executable-to-a-dll?view=vs-2019\">\u0421\u0432\u044f\u0437\u044b\u0432\u0430\u043d\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0441 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 DLL.<\/a><\/p>\n<p>  <\/p>\n<hr\/>\n<p>  <\/p>\n<p>\u0412 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u043c \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435 1 \u0448\u0430\u0431\u043b\u043e\u043d\u0435 \u0435\u0441\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>SomeFunction<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0438\u0437 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438. \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u043f\u0440\u0438 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <code>__declspec(dllexport)<\/code>. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">#define DLL_EXPORT __declspec(dllexport)  void DLL_EXPORT SomeFunction(const LPCSTR sometext);<\/code><\/pre>\n<p>  <\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u0438, \u043d\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043d\u0435\u043b\u044c\u0437\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0441\u043d\u0430\u0440\u0443\u0436\u0438.<\/p>\n<p>  <\/p>\n<h2 id=\"dll--python-1\">DLL &amp; Python<\/h2>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c, \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0443\u0436\u0435 \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0435 DLL, \u0437\u0430\u0442\u0435\u043c, \u043a\u0430\u043a \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0438\u0437 \u043d\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b, \u0430 \u0443\u0436\u0435 \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e, \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u0434\u043e\u0434\u0435\u043b\u0430\u044e \u0448\u0430\u0431\u043b\u043e\u043d \u0438\u0437 Code Blocks \u0438 \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 DLL.<\/p>\n<p>  <\/p>\n<h3 id=\"podklyuchenie-dll\"><em>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 DLL<\/em><\/h3>\n<p>  <\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 \u0432 Python \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0442\u0438\u043f\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b\u043c\u0438 \u0441 \u0442\u0438\u043f\u0430\u043c\u0438 \u044f\u0437\u044b\u043a\u0430 \u0421 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <code>ctypes<\/code>. \u0412 <a href=\"https:\/\/docs.python.org\/2\/library\/ctypes.html#loading-dynamic-link-libraries\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043d\u0430 ctypes<\/a> \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0441\u0442\u043e\u0438\u0442 \u0443\u0434\u0435\u043b\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435.<\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043d\u0430\u0447\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 DLL, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \u043d\u0430 Python. \u0421\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0442\u0440\u0435\u043c\u044f \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438:<\/p>\n<p>  <\/p>\n<ul>\n<li><em>cdll<\/em> \u2014 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442, \u0430 \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0439 DLL \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430\u043c \u044d\u0442\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 cdecl.<\/li>\n<li><em>windll<\/em> \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 stdcall. \u0412 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u043c \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u0430 cdll.<\/li>\n<li><em>oledll<\/em> \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 stdcall \u0438 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 \u043a\u043e\u0434 \u043e\u0448\u0438\u0431\u043a\u0438 Windows HRESULT. \u041a\u043e\u0434 \u043e\u0448\u0438\u0431\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f WindowsError.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041f\u0440\u043e <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A1%D0%BE%D0%B3%D0%BB%D0%B0%D1%88%D0%B5%D0%BD%D0%B8%D0%B5_%D0%BE_%D0%B2%D1%8B%D0%B7%D0%BE%D0%B2%D0%B5\">\u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f \u043e \u0432\u044b\u0437\u043e\u0432\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0439<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e Windows DLL \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432\u0441\u0435\u043c \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u044f\u0437\u044b\u043a\u0430 \u0421 \u2014 <code>printf()<\/code>. \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 <code>msvcrt.dll<\/code> \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043f\u0430\u043f\u043a\u0435 <code>C:\\WINDOWS\\System32<\/code>. <\/p>\n<p>  <\/p>\n<p><strong><em>\u041a\u043e\u0434 Python:<\/em><\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"python\">from ctypes import *  lib = cdll.msvcrt   # \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 msvcrt.dll lib.printf(b&quot;From dll with love!\\n&quot;) # \u0432\u044b\u0432\u043e\u0434 \u0441\u0442\u0440\u043e\u043a\u0438 \u0447\u0435\u0440\u0435\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e printf  var_a = 31 lib.printf(b&quot;Print int_a = %d\\n&quot;, var_a) # \u0432\u044b\u0432\u043e\u0434 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 int                                  # printf(&quot;Print int_a = %d\\n&quot;, var_a); \/\/ \u0430\u043d\u0430\u043b\u043e\u0433 \u0432 \u0421<\/code><\/pre>\n<p>  <\/p>\n<p><strong><em>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/em><\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"python\">From dll with love! Print int_a = 31<\/code><\/pre>\n<p>  <\/p>\n<p>\u041c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 <code>windll<\/code> \u043b\u0438\u0431\u043e <code>oledll<\/code>, \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0440\u0430\u0437\u043d\u0438\u0446\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u0442, \u0432\u044b\u0432\u043e\u0434 \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u0441\u044f.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0440\u0435\u0447\u044c \u043d\u0435 \u0438\u0434\u0435\u0442 \u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435, \u0442\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u044b\u0437\u043e\u0432 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435\u043c \u043f\u0443\u0442\u0438 \u043d\u0430 dll. \u0412 <code>ctypes<\/code> \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d \u043c\u0435\u0442\u043e\u0434 <code>LoadLibrary<\/code>. \u041d\u043e \u0435\u0441\u0442\u044c \u0435\u0449\u0435 \u0431\u043e\u043b\u0435\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 <code>CDLL<\/code>, \u043e\u043d \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u0442 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e <code>cdll.LoadLibrary<\/code>. \u0412 \u043e\u0431\u0449\u0435\u043c, \u043d\u0438\u0436\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u0434\u0432\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0432\u044b\u0437\u043e\u0432\u0430 \u043e\u0434\u043d\u043e\u0439 \u0438 \u0442\u043e\u0439 \u0436\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 msvcrt.dll.<\/p>\n<p>  <\/p>\n<p><strong><em>\u041a\u043e\u0434 Python:<\/em><\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"python\">from ctypes import *  lib = cdll.LoadLibrary(r&quot;C:\\Windows\\System32\\msvcrt.dll&quot;)    lib.printf(b&quot;From dll with love!\\n&quot;)    # \u0432\u044b\u0432\u043e\u0434 \u0441\u0442\u0440\u043e\u043a\u0438 \u0447\u0435\u0440\u0435\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e printf  lib_2 = CDLL(r&quot;C:\\Windows\\System32\\msvcrt.dll&quot;) # \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 msvcrt.dll  var_a = 31 lib_2.printf(b&quot;Print int_a = %d\\n&quot;, var_a)  # \u0432\u044b\u0432\u043e\u0434 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 int<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418\u043d\u043e\u0433\u0434\u0430 \u0441\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u043b\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0443 DLL, \u0438\u043c\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e Python \u043d\u0435 &quot;\u043f\u0440\u0438\u043c\u0435\u0442&quot;\u2026 \u043d\u0443 \u0431\u044b\u0432\u0430\u0435\u0442. \u041d\u0430 \u044d\u0442\u043e\u0442 \u0441\u043b\u0443\u0447\u0430\u0439 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>getattr(lib, attr_name)<\/code>. \u0414\u0430\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0434\u0432\u0430 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430: \u043e\u0431\u044a\u0435\u043a\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0438 \u0438\u043c\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430, \u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430. <\/p>\n<p>  <\/p>\n<p><strong><em>\u041a\u043e\u0434 Python:<\/em><\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"python\">from ctypes import *  lib = cdll.LoadLibrary(r&quot;C:\\Windows\\System32\\msvcrt.dll&quot;)     var_c = 51 print_from_C = getattr(lib, &quot;printf&quot;)  # \u0434\u0430, \u0442\u0443\u0442 \u043c\u043e\u0436\u043d\u043e \u0432\u043f\u0438\u0441\u0430\u0442\u044c \u0434\u0430\u0436\u0435 &quot;??2@YAPAXI@Z&quot; print_from_C(b&quot;Print int_c = %d\\n&quot;, var_c)<\/code><\/pre>\n<p>  <\/p>\n<p><strong><em>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/em><\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"python\">Print int_c = 51<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u043a\u0430\u043a \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u041e\u0434\u043d\u0430\u043a\u043e, \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0432 DLL \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0438\u043b\u0438 \u0446\u0438\u0444\u0440\u044b. \u0411\u044b\u0432\u0430\u044e\u0442 \u0441\u043b\u0443\u0447\u0430\u0438, \u043a\u043e\u0433\u0434\u0430 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 \u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0438, \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0438\u043b\u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u043e\u0433\u0443\u0442 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b, \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 \u0438 \u043c\u043d\u043e\u0433\u043e \u0434\u0440\u0443\u0433\u043e\u0435.<\/p>\n<p>  <\/p>\n<h3 id=\"tipy-dannyh-v-s-i-python\"><em>\u0422\u0438\u043f\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0421 \u0438 Python<\/em><\/h3>\n<p>  <\/p>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c <code>ctypes<\/code> \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0438\u043f\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b\u0435 \u0441 \u0442\u0438\u043f\u0430\u043c\u0438 \u0432 \u044f\u0437\u044b\u043a\u0435 \u0421. \u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u044f \u0442\u0438\u043f\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445. <\/p>\n<p>  <\/p>\n<div class=\"scrollable-table\">\n<table>\n<thead>\n<tr>\n<th>\u0421types type<\/th>\n<th>C type<\/th>\n<th>Python type<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><a href=\"https:\/\/docs.python.org\/2\/library\/ctypes.html#ctypes.c_bool\"><code>c_bool<\/code><\/a><\/td>\n<td><code>_Bool<\/code><\/td>\n<td>bool (1)<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/docs.python.org\/2\/library\/ctypes.html#ctypes.c_char\"><code>c_char<\/code><\/a><\/td>\n<td><code>char<\/code><\/td>\n<td>1-character string<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/docs.python.org\/2\/library\/ctypes.html#ctypes.c_wchar\"><code>c_wchar<\/code><\/a><\/td>\n<td><code>wchar_t<\/code><\/td>\n<td>1-character unicode string<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/docs.python.org\/2\/library\/ctypes.html#ctypes.c_byte\"><code>c_byte<\/code><\/a><\/td>\n<td><code>char<\/code><\/td>\n<td>int\/long<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/docs.python.org\/2\/library\/ctypes.html#ctypes.c_ubyte\"><code>c_ubyte<\/code><\/a><\/td>\n<td><code>unsigned char<\/code><\/td>\n<td>int\/long<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/docs.python.org\/2\/library\/ctypes.html#ctypes.c_short\"><code>c_short<\/code><\/a><\/td>\n<td><code>short<\/code><\/td>\n<td>int\/long<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/docs.python.org\/2\/library\/ctypes.html#ctypes.c_ushort\"><code>c_ushort<\/code><\/a><\/td>\n<td><code>unsigned short<\/code><\/td>\n<td>int\/long<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/docs.python.org\/2\/library\/ctypes.html#ctypes.c_int\"><code>c_int<\/code><\/a><\/td>\n<td><code>int<\/code><\/td>\n<td>int\/long<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/docs.python.org\/2\/library\/ctypes.html#ctypes.c_uint\"><code>c_uint<\/code><\/a><\/td>\n<td><code>unsigned int<\/code><\/td>\n<td>int\/long<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/docs.python.org\/2\/library\/ctypes.html#ctypes.c_long\"><code>c_long<\/code><\/a><\/td>\n<td><code>long<\/code><\/td>\n<td>int\/long<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/docs.python.org\/2\/library\/ctypes.html#ctypes.c_ulong\"><code>c_ulong<\/code><\/a><\/td>\n<td><code>unsigned long<\/code><\/td>\n<td>int\/long<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/docs.python.org\/2\/library\/ctypes.html#ctypes.c_longlong\"><code>c_longlong<\/code><\/a><\/td>\n<td><code>__int64<\/code> or <code>long long<\/code><\/td>\n<td>int\/long<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/docs.python.org\/2\/library\/ctypes.html#ctypes.c_ulonglong\"><code>c_ulonglong<\/code><\/a><\/td>\n<td><code>unsigned __int64<\/code> or <code>unsigned long long<\/code><\/td>\n<td>int\/long<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/docs.python.org\/2\/library\/ctypes.html#ctypes.c_float\"><code>c_float<\/code><\/a><\/td>\n<td><code>float<\/code><\/td>\n<td>float<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/docs.python.org\/2\/library\/ctypes.html#ctypes.c_double\"><code>c_double<\/code><\/a><\/td>\n<td><code>double<\/code><\/td>\n<td>float<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/docs.python.org\/2\/library\/ctypes.html#ctypes.c_longdouble\"><code>c_longdouble<\/code><\/a><\/td>\n<td><code>long double<\/code><\/td>\n<td>float<\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/docs.python.org\/2\/library\/ctypes.html#ctypes.c_char_p\"><code>c_char_p<\/code><\/a><\/td>\n<td><code>char *<\/code> (NUL terminated)<\/td>\n<td>string or <code>None<\/code><\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/docs.python.org\/2\/library\/ctypes.html#ctypes.c_wchar_p\"><code>c_wchar_p<\/code><\/a><\/td>\n<td><code>wchar_t *<\/code> (NUL terminated)<\/td>\n<td>unicode or <code>None<\/code><\/td>\n<\/tr>\n<tr>\n<td><a href=\"https:\/\/docs.python.org\/2\/library\/ctypes.html#ctypes.c_void_p\"><code>c_void_p<\/code><\/a><\/td>\n<td><code>void *<\/code><\/td>\n<td>int\/long or <code>None<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>  <\/p>\n<p><em><a href=\"https:\/\/docs.python.org\/3.3\/library\/ctypes.html\">\u0422\u0430\u0431\u043b\u0438\u0446\u0430 1<\/a> \u2014 \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u0442\u0438\u043f\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u044f\u0437\u044b\u043a\u0430 Python \u0438 \u044f\u0437\u044b\u043a\u0430 C, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043c\u043e\u0434\u0443\u043b\u044c <code>ctypes<\/code>.<\/em><\/p>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u0441\u0442\u043e\u0438\u0442 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u2014 \u044d\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438, \u043a\u0443\u0434\u0430 \u0431\u0435\u0437 \u043d\u0438\u0445? \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u0433\u0434\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u043d\u0435\u0451, \u0430 \u043f\u043e\u0442\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0435\u043c printf() \u0434\u043b\u044f \u043d\u0438\u0445:<\/p>\n<p>  <\/p>\n<p><strong><em>\u041a\u043e\u0434:<\/em><\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"python\">from ctypes import *  lib = CDLL(r&quot;C:\\Windows\\System32\\msvcrt.dll&quot;) printf = lib.printf # \u043e\u0431\u044a\u0435\u043a\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 printf()  int_var = c_int(17) # \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0442\u0438\u043f\u0430 int \u0438\u0437 C printf(b&quot;int_var = %d\\n&quot;, int_var)  str_ = b&quot;Hello, World\\n&quot; # \u0441\u0442\u0440\u043e\u043a\u0430 \u0432 Python str_pt = c_char_p(str_)  # \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0443 printf(str_pt)             print(str_pt)             print(str_pt.value) # str_pt - \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0443, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 value<\/code><\/pre>\n<p>  <\/p>\n<p><strong><em>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/em><\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"python\">int_var = 17 Hello, World c_char_p(2814054827168) b'Hello, World\\n'<\/code><\/pre>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c, \u0442\u043e \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u0430\u0442\u044c (\u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043e\u043d \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442) \u043c\u043e\u0436\u043d\u043e \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 <code>value<\/code>, \u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u044b\u0448\u0435. <\/p>\n<p>  <\/p>\n<h3 id=\"argumenty-funkciy-i-vozvraschaemye-znacheniya\"><em>\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f<\/em><\/h3>\n<p>  <\/p>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043b\u044e\u0431\u0430\u044f \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0438\u0437 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0442\u0438\u043f <code>int<\/code>. \u0414\u0440\u0443\u0433\u0438\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0435 \u0442\u0438\u043f\u044b \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 <code>restype<\/code>. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0442\u0438\u043f\u044b \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u043c <code>argtypes<\/code>. <\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>strcat<\/code> \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0434\u0432\u0430 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0438 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0434\u0438\u043d \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u043d\u043e\u0432\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0435\u0439 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f.<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">char *strcat (char *destination, const char *append); \/\/ C \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0430\u0442\u043e\u043d\u0430\u0446\u0438\u0438 (\u0441\u043a\u043b\u0435\u0438\u0432\u0430\u043d\u0438\u044f) \u0441\u0442\u0440\u043e\u043a <\/code><\/pre>\n<p>  <\/p>\n<p><strong><em>\u041a\u043e\u0434 Python:<\/em><\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"python\">from ctypes import *  libc = CDLL(r&quot;C:\\Windows\\System32\\msvcrt.dll&quot;)  strcat = libc.strcat        # \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 strcat strcat.restype = c_char_p   # \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430                                 # \u0441\u0442\u0440\u043e\u043a\u0443 strcat.argtypes = [c_char_p, c_char_p] # \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0442\u0438\u043f\u044b \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438  str_1 = b&quot;Hello,&quot; str_2 = b&quot; Habr!&quot; str_pt = strcat(str_1, str_2) # \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e  print(str_pt)<\/code><\/pre>\n<p>  <\/p>\n<p><strong><em>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/em><\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"python\">b'Hello, Habr!'<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043c \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0433\u043e\u0442\u043e\u0432\u044b\u0445 DLL. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0437\u043d\u0430\u043d\u0438\u044f \u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 DLL \u0438 \u043c\u043e\u0434\u0443\u043b\u0435 <code>ctypes<\/code> \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0438 \u043d\u0430\u0447\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443.<\/p>\n<p>  <\/p>\n<h3 id=\"svoya-dll-i-ee-ispolzovanie\"><em>\u0421\u0432\u043e\u044f DLL \u0438 \u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435<\/em><\/h3>\n<p>  <\/p>\n<h4 id=\"primer-1\"><em>\u041f\u0440\u0438\u043c\u0435\u0440 1<\/em><\/h4>\n<p>  <\/p>\n<p>\u0428\u0430\u0431\u043b\u043e\u043d DLL \u0443\u0436\u0435 \u0431\u044b\u043b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d \u0432\u044b\u0448\u0435, \u0430 \u0441\u0435\u0439\u0447\u0430\u0441, \u043a\u043e\u0433\u0434\u0430 \u0434\u0435\u043b\u043e \u0434\u043e\u0448\u043b\u043e \u0434\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0432\u043e\u0435\u0439 DLL \u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043d\u0435\u0439, \u0432\u044b\u0441\u043a\u043e\u0447\u0438\u043b\u0438 \u043f\u0435\u0440\u0432\u044b\u0435 \u0438 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u0435 \u0433\u0440\u0430\u0431\u043b\u0438 \u2014 \u043d\u0435\u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u044c \u0440\u0430\u0437\u0440\u044f\u0434\u043d\u043e\u0441\u0442\u0438 DLL \u0438 Python. \u0423 \u043c\u0435\u043d\u044f \u043d\u0430 \u041f\u041a \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d Python x64, \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u043a\u0430\u043a \u0431\u044b \u043d\u0435 \u0431\u044b\u043b\u0438 DLL \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b, \u0440\u0430\u0437\u0440\u044f\u0434\u043d\u043e\u0441\u0442\u044c DLL \u0434\u043e\u043b\u0436\u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u0440\u044f\u0434\u043d\u043e\u0441\u0442\u0438 Python. \u0422\u043e \u0435\u0441\u0442\u044c, \u043b\u0438\u0431\u043e \u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 x64 \u0438 Python x64, \u043b\u0438\u0431\u043e \u0438 \u0442\u043e \u0438 \u0442\u043e x32. \u0425\u043e\u0440\u043e\u0448\u043e, \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c.<\/p>\n<p>  <\/p>\n<p>\u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u043e\u0436\u0443 \u043a\u043e\u0434 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 DLL, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0432\u044b\u0432\u043e\u0434 \u0441\u0442\u0440\u043e\u043a\u0438 \u043f\u0440\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0440\u0430\u0437\u0431\u043e\u0440 \u0438 \u0432\u044b\u0432\u043e\u0434 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0432\u044b\u0437\u0432\u0430\u043b\u0430\u0441\u044c <code>DllMain<\/code>. \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u0443\u0447\u0430\u0441\u0442\u043a\u0438 \u043a\u043e\u0434\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0438 \u043a\u043e\u0433\u0434\u0430 \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442. <\/p>\n<p>  <\/p>\n<p><strong><em>\u041a\u043e\u0434 DLL \u043d\u0430 \u0421:<\/em><\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">\/\/ a sample exported function void __declspec(dllexport) SomeFunction(const LPCSTR sometext) {     MessageBoxA(0, sometext, &quot;DLL Message&quot;, MB_OK | MB_ICONINFORMATION); }  extern &quot;C&quot; DLL_EXPORT BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {     switch (fdwReason)     {         case DLL_PROCESS_ATTACH:             printf(&quot;Load DLL in Python\\n&quot;);              printf(&quot;HINSTANCE = %p\\n&quot;,hinstDLL); \/\/ \u0412\u044b\u0432\u043e\u0434 \u043e\u043f\u0438\u0441\u0430\u0442\u0435\u043b\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 DLL              if (lpvReserved)                     \/\/ \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438               printf(&quot;DLL loaded with implicit layout\\n&quot;);              else               printf(&quot;DLL loaded with explicit layout\\n&quot;);                       return 1;                            \/\/ \u0423\u0441\u043f\u0435\u0448\u043d\u0430\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f          case DLL_PROCESS_DETACH:             printf(&quot;DETACH DLL\\n&quot;);             break;          case DLL_THREAD_ATTACH:             break;          case DLL_THREAD_DETACH:             break;     }     return TRUE; \/\/ succesful }<\/code><\/pre>\n<p>  <\/p>\n<p><strong><em>\u041a\u043e\u0434 Python:<\/em><\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"python\">from ctypes import *  lib_dll = cdll.LoadLibrary(&quot;DLL_example.dll&quot;)   # \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u044e \u0441\u0432\u043e\u044e DLL str_ = b'Hello, Habr!' p_str = c_char_p(str_)                          # \u043f\u043e\u043b\u0443\u0447\u0430\u044e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0443 str_ lib_dll.SomeFunction(p_str)                     # \u0432\u044b\u0437\u044b\u0432\u0430\u044e SomeFunction \u0438\u0437 DLL<\/code><\/pre>\n<p>  <\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>SomeFunction<\/code> \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0443 \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0435\u0451 \u0432 \u043e\u043a\u043d\u043e. \u041d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435 \u043d\u0438\u0436\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ud\/gg\/of\/udggof8zbzwahblm-mhbqcl8fxe.png\"\/>  <\/p>\n<p><em>\u0420\u0438\u0441\u0443\u043d\u043e\u043a 2 \u2014 \u0414\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0438\u0437 Code Blocks.<\/em><\/p>\n<p>  <\/p>\n<p>\u0412\u0441\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0432 \u043a\u0435\u0439\u0441\u0435 <code>DLL_PROCESS_ATTACH<\/code>, \u043a\u043e\u0434 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043d\u0438\u0436\u0435, \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u043e\u0439 \u0432 Python \u043a\u043e\u0434\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">lib_dll = cdll.LoadLibrary(&quot;DLL_example.dll&quot;)   # \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/00\/sr\/gy\/00srgyt5vxirts1gwgwiostp2ji.png\"\/>  <\/p>\n<p><em>\u0420\u0438\u0441\u0443\u043d\u043e\u043a 3 \u2014 \u0414\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u043f\u0440\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 DLL.<\/em><\/p>\n<p>  <\/p>\n<h4 id=\"primer-2\"><em>\u041f\u0440\u0438\u043c\u0435\u0440 2<\/em><\/h4>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u0434\u0432\u0435\u0441\u0442\u0438 \u0438\u0442\u043e\u0433 \u043f\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e DLL \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438\u0437 Python, \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0435\u0441\u0442\u044c \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0430\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u043d\u043e\u0432\u044b\u0445 \u0447\u0435\u0440\u0435\u0437 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 \u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0438 \u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445. \u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0434\u0430\u0435\u0442 \u043f\u043e\u043d\u044f\u0442\u044c, \u043a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0430\u043d\u0430\u043b\u043e\u0433 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0421 \u0432 Python. \u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u043e\u0436\u0443 \u043a\u043e\u0434 <code>main.c<\/code>, <code>man.h<\/code> \u0438 <code>main.py<\/code>.<\/p>\n<p>  <\/p>\n<p><strong><em>\u041a\u043e\u0434 DLL \u043d\u0430 \u0421:<\/em><\/strong> <\/p>\n<p>  <\/p>\n<p><em>main.h<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">#ifndef __MAIN_H__ #define __MAIN_H__  #include &lt;windows.h&gt; #include &lt;stdio.h&gt; #include &lt;string.h&gt; #include &lt;malloc.h&gt;  #define DLL_EXPORT __declspec(dllexport) \/\/ \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438,                                           \/\/ \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0438\u0437                                                 \/\/ \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 #ifdef __cplusplus extern &quot;C&quot; { #endif  struct Pasport{     char*  name;     char*  sorname;     int var; };  void DLL_EXPORT SetName(char* new_name); void DLL_EXPORT SetSorname(char* new_sorname); void DLL_EXPORT SetPasport(Pasport* new_pasport); void DLL_EXPORT GetPasport(void);  #ifdef __cplusplus } #endif #endif \/\/ __MAIN_H__<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u043a\u043e\u0434\u0435 <code>main.h<\/code> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 Pasport \u0441 \u0442\u0440\u0435\u043c\u044f \u043f\u043e\u043b\u044f\u043c\u0438: \u0434\u0432\u0430 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u0438 \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u0430\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0447\u0435\u0442\u044b\u0440\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u044b, \u043a\u0430\u043a \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u0435.<\/p>\n<p>  <\/p>\n<p><strong><em>\u041a\u043e\u0434 DLL \u043d\u0430 \u0421:<\/em><\/strong><\/p>\n<p>  <\/p>\n<p><em>main.c<\/em><\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">#include &quot;main.h&quot;  #define SIZE_BUF 20  struct Pasport pasport; \/\/ \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e pasport \u0442\u0438\u043f\u0430 Pasport  \/\/ \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0438\u043c\u0435\u043d\u0438 void DLL_EXPORT SetName(char* new_name) {     printf(&quot;SetName\\n&quot;);     strcpy(pasport.name, new_name); }  \/\/ \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0444\u0430\u043c\u0438\u043b\u0438\u0438 void DLL_EXPORT SetSorname(char* new_sorname) {     printf(&quot;SetSorname\\n&quot;);     strcpy(pasport.sorname, new_sorname); }  \/\/ \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043f\u043e\u043b\u0435\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b. \/\/ \u041d\u0430 \u0432\u0445\u043e\u0434 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 void DLL_EXPORT SetPasport(Pasport* new_pasport) {     printf(&quot;SetPasport\\n&quot;);     strcpy(pasport.name, new_pasport-&gt;name);     strcpy(pasport.sorname, new_pasport-&gt;sorname);     pasport.var = new_pasport-&gt;var; }  \/\/ \u0412\u044b\u0432\u0435\u0441\u0442\u0438 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b void DLL_EXPORT GetPasport(void) {     printf(&quot;GetPasport: %s | %s | %d\\n&quot;, pasport.name, pasport.sorname, pasport.var); }  extern &quot;C&quot; DLL_EXPORT BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {     switch (fdwReason)     {         case DLL_PROCESS_ATTACH:             printf(&quot;Load DLL in Python\\n&quot;);              pasport.name = (char*)malloc(SIZE_BUF * sizeof(char)); \/\/ \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438             pasport.sorname = (char*)malloc(SIZE_BUF * sizeof(char)); \/\/ \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438              pasport.var = 17; \/\/ \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0430 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439             SetName(&quot;Default&quot;); \/\/ \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0430 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0431\u0443\u0444\u0435\u0440\u0430 \u0438\u043c\u0435\u043d\u0438             SetSorname(&quot;Pasport&quot;); \/\/ \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0430 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0431\u0443\u0444\u0435\u0440\u0430 \u0444\u0430\u043c\u0438\u043b\u0438\u0438             return 1;          case DLL_PROCESS_DETACH:             free (pasport.name); \/\/ \u041e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438             free (pasport.sorname); \/\/ \u041e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438             printf(&quot;DETACH DLL\\n&quot;);             break;          case DLL_THREAD_ATTACH:             break;          case DLL_THREAD_DETACH:             break;     }     return TRUE; \/\/ succesful }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u043d\u0443\u0442\u0440\u0438 \u043a\u0435\u0439\u0441\u0430 <code>DLL_PROCESS_ATTACH<\/code> \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438 \u043f\u043e\u0434 \u0441\u0442\u0440\u043e\u043a\u0438 \u0438 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0430\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u043e\u043b\u0435\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b. \u0412\u044b\u0448\u0435 <code>DllMain<\/code> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0438:<\/p>\n<p>  <\/p>\n<ul>\n<li>\n<p><strong>GetPasport<\/strong> \u2014 \u0432\u044b\u0432\u043e\u0434 \u043f\u043e\u043b\u0435\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b <code>pasport<\/code> \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c.<\/p>\n<p>  <\/li>\n<li>\n<p>*<em>SetName(char<\/em> new_name)** \u2014 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043f\u043e\u043b\u044f <code>name<\/code> \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b <code>pasport<\/code>. <\/p>\n<p>  <\/li>\n<li>\n<p>*<em>SetSorname(char<\/em> new_sorname)** \u2014 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043f\u043e\u043b\u044f <code>sorname<\/code> \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b <code>pasport<\/code>. <\/p>\n<p>  <\/li>\n<li>\n<p>*<em>SetPasport(Pasport<\/em> new_pasport)** \u2014 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0432\u0441\u0435\u0445 \u043f\u043e\u043b\u0435\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b <code>pasport<\/code>. \u041f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0441 \u043d\u043e\u0432\u044b\u043c\u0438 \u043f\u043e\u043b\u044f\u043c\u0438.<\/p>\n<p>  <\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0432 Python. <\/p>\n<p>  <\/p>\n<p><strong><em>\u041a\u043e\u0434 \u043d\u0430 Python<\/em><\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"python\">from ctypes import *  class Pasport(Structure):              # \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 Pasport      _fields_ = [(&quot;name&quot;, c_char_p),    # \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 main.h                 (&quot;sorname&quot;, c_char_p),                 (&quot;var&quot;, c_int)]  lib_dll = cdll.LoadLibrary(&quot;DLL_example.dll&quot;)   # \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u044e \u0441\u0432\u043e\u044e DLL lib_dll.SetPasport.argtypes  = [POINTER(Pasport)] # \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c, \u0442\u0438\u043f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438  lib_dll.GetPasport()          # \u0432\u044b\u0432\u043e\u0434 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b  lib_dll.SetName(c_char_p(b&quot;Yury&quot;)) lib_dll.SetSorname(c_char_p(b&quot;Orlov&quot;))  lib_dll.GetPasport()          # \u0432\u044b\u0432\u043e\u0434 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b  name = str.encode((&quot;Vasiliy&quot;))  # \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u043d\u0430 \u0431\u0430\u0439\u0442\u043e\u0432\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 sorname = c_char_p((b'Pupkin')) # \u0432\u0442\u043e\u0440\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u043d\u0430 \u0431\u0430\u0439\u0442\u043e\u0432\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443  pasport = Pasport(name, sorname, 34) # \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b Pasport  lib_dll.SetPasport(pointer(pasport)) # \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432 DLL  lib_dll.GetPasport()          # \u0432\u044b\u0432\u043e\u0434 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u043a\u043e\u0434\u0435 \u0432\u044b\u0448\u0435 \u043c\u043d\u043e\u0433\u043e\u0435 \u0443\u0436\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u043e, \u043a\u0440\u043e\u043c\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e\u0439 \u0442\u043e\u0439, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0430 \u0432 DLL \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u043d\u0430 \u044d\u0442\u0443 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0438\u0437 Python \u0432 DLL.<\/p>\n<p>  <\/p>\n<p><strong><em>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/em><\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"python\">Load DLL in Python SetName SetSorname GetPasport: Default | Pasport | 17 SetName SetSorname GetPasport: Yury | Orlov | 17 SetPasport GetPasport: Vasiliy | Pupkin | 34 DETACH DLL<\/code><\/pre>\n<p>  <\/p>\n<p><strong><em>P.S:<\/em><\/strong> \u0414\u0443\u043c\u0430\u044e, \u0447\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0438 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f \u0438\u0437 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u043e\u043c\u043e\u0433\u0443\u0442 \u0432\u0430\u043c \u0431\u044b\u0441\u0442\u0440\u043e \u043d\u0430\u0447\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c DLL \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0438\u0437 Python. \u041d\u0443 \u0430 \u0435\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u0441\u043c\u043e\u0433\u043b\u0438 \u043d\u0430\u0439\u0442\u0438 \u043e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u0441\u0432\u043e\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0433\u0443\u0442 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0438\u0436\u0435. \u0415\u0441\u043b\u0438 \u0443 \u043a\u043e\u0433\u043e-\u0442\u043e \u0431\u0443\u0434\u0443\u0442 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u2014 \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c, \u0435\u0441\u043b\u0438 \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u044f \u2014 \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c. \u0421\u043f\u0430\u0441\u0438\u0431\u043e, \u0447\u0442\u043e \u0434\u043e\u0447\u0438\u0442\u0430\u043b\u0438!<\/p>\n<p>  <\/p>\n<h3 id=\"poleznye-ssylki\"><em>\u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438:<\/em><\/h3>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/docs.python.org\/2\/library\/ctypes.html#loading-dynamic-link-libraries\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 ctypes<\/a> \u2014 \u043c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432<\/li>\n<li><a href=\"https:\/\/support.microsoft.com\/ru-ru\/help\/815065\/what-is-a-dll\">\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 DLL?<\/a> \u2014 \u043c\u043d\u043e\u0433\u043e \u0438 \u043f\u043e\u043b\u043d\u043e \u043e dll.<\/li>\n<li>[C\/C++ \u0438\u0437 Python (ctypes)](C\/C++ \u0438\u0437 Python (ctypes)) \u2014 \u0445\u043e\u0440\u043e\u0448\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f.<\/li>\n<li><a href=\"https:\/\/habr.com\/ru\/post\/466575\/\">\u041f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u044b\u0445 \u0441\u043f\u0438\u0441\u043a\u043e\u0432 \u0438\u0437 python \u0432 DLL<\/a><\/li>\n<li><a href=\"https:\/\/docs.microsoft.com\/ru-ru\/cpp\/build\/linking-an-executable-to-a-dll?view=vs-2019\">\u0421\u0432\u044f\u0437\u044b\u0432\u0430\u043d\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0441 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 DLL<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/carterjones\/hello-world-dll\">Github \u0441 dll &quot;Hello-world&quot; \u0438 \u0435\u0451 \u043a\u043e\u0434\u043e\u043c<\/a> \u2014 \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/li>\n<li><a href=\"https:\/\/habr.com\/ru\/post\/164193\/\">\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 TCHAR, WCHAR, LPSTR, LPWSTR,LPCTSTR<\/a> \u2014 \u043e \u0442\u0438\u043f\u0430\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/li>\n<li><a href=\"http:\/\/citforum.ru\/book\/cook\/dll1.shtml\">\u0414\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0434\u043b\u044f \u0433\u0443\u0440\u043c\u0430\u043d\u043e\u0432<\/a> \u2014 \u0441\u0442\u0430\u0442\u044c\u044f \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u043d\u044e\u0430\u043d\u0441\u043e\u0432.<\/li>\n<\/ul>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/499152\/\"> https:\/\/habr.com\/ru\/post\/499152\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/499152\/\">\n<h1 id=\"dll--python\">DLL &amp; Python<\/h1>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/kd\/c5\/he\/kdc5hec_pw95siaqzue5_ob099c.png\" alt=\"image\"\/><\/p>\n<p>  <\/p>\n<p>\u041d\u0435\u0434\u0430\u0432\u043d\u043e \u043c\u0435\u043d\u044f \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043b\u0430 \u0442\u0435\u043c\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f DLL \u0438\u0437 Python. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e \u0431\u044b\u043b\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u0438\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435, \u043d\u0430 \u0442\u043e\u0442 \u0441\u043b\u0443\u0447\u0430\u0439, \u0435\u0441\u043b\u0438 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043c\u0435\u043d\u044f\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a. \u041f\u043e\u0441\u043b\u0435 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u043d\u0430 \u044d\u0442\u0443 \u0442\u0435\u043c\u0443, \u0441\u0442\u0430\u043b\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u043c\u043e\u0436\u0435\u0442 \u0441\u0438\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 Python. \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0446\u0435\u043b\u0438 \u0431\u044b\u043b\u0438 \u0434\u043e\u0441\u0442\u0438\u0433\u043d\u0443\u0442\u044b, \u0430 \u0447\u0442\u043e\u0431\u044b \u043e\u043f\u044b\u0442 \u043d\u0435 \u0431\u044b\u043b \u0437\u0430\u0431\u044b\u0442, \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0434\u0432\u0435\u0441\u0442\u0438 \u0438\u0442\u043e\u0433 \u0432 \u0432\u0438\u0434\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u2014 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0437\u043d\u0430\u043d\u0438\u044f \u0438 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438, \u0430 \u0437\u0430\u043e\u0434\u043d\u043e \u0435\u0449\u0451 \u043b\u0443\u0447\u0448\u0435 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0442\u0435\u043c\u0435.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c \u0432\u0430\u0441 \u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u0441\u0442\u0430\u0442\u044c\u044f \u0441 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438, \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u043c\u0438 \u0438 \u043f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u044f\u043c\u0438 \u043a \u043d\u0438\u043c.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-302542","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/302542","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=302542"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/302542\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=302542"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=302542"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=302542"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}