{"id":497281,"date":"2026-10-04T15:10:39","date_gmt":"2026-10-04T15:10:39","guid":{"rendered":"https:\/\/savepearlharbor.com\/?p=497281"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=497281","title":{"rendered":"ABI\u2011\u0440\u0430\u0437\u0440\u044b\u0432"},"content":{"rendered":"<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u041d\u0438 \u0434\u043b\u044f \u043a\u043e\u0433\u043e \u043d\u0435 \u0441\u0435\u043a\u0440\u0435\u0442, \u0447\u0442\u043e \u0432 \u044f\u0437\u044b\u043a\u0435 C \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u0432\u0430\u0448\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u0432\u044b\u0442\u0435\u043a\u0430\u044e\u0449\u0438\u043c\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u044f\u043c\u0438, \u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0438\u0437 \u043d\u0438\u0445 \u043e\u0431\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0431\u0430\u043d\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 \u0433\u0438\u0433\u0438\u0435\u043d\u044b, \u0441\u0430\u043d\u0438\u0442\u0430\u0439\u0437\u0435\u0440\u0430\u043c\u0438, \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430\u043c\u0438, \u043b\u0438\u043d\u0442\u0435\u0440\u0430\u043c\u0438, \u0434\u0430 \u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u044b \u0432 \u0446\u0435\u043b\u043e\u043c \u043d\u0435 \u043f\u043b\u043e\u0445\u043e \u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0442 \u0440\u0435\u0448\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0434\u043e \u0438\u0445 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0435. \u041d\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0438 \u043f\u043e\u043d\u044f\u0442\u044c, \u0432 \u0447\u0435\u043c \u043f\u0440\u0438\u0447\u0438\u043d\u0430, \u043d\u0435 \u0442\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u043e, \u0445\u043e\u0442\u044f \u0441\u0430\u043c\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u043c\u043e\u0436\u0435\u0442 \u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u0434\u0430\u0436\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e\u0439 \u043f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u0447\u0438\u043d\u043d\u043e-\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0441\u0432\u044f\u0437\u0438.<\/p>\n<p>\u041e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0442\u043e\u043c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 ABI, \u044f \u043d\u0435 \u0431\u0443\u0434\u0443, \u0434\u0430\u0431\u044b \u043d\u0435 \u0440\u0430\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u043b\u0438\u0448\u043d\u044e\u044e \u043f\u043e\u043b\u0435\u043c\u0438\u043a\u0443, \u043d\u0430 \u0425\u0430\u0431\u0440\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u0442\u0430\u0442\u0435\u0439 \u043d\u0430 \u044d\u0442\u0443 \u0442\u0435\u043c\u0443. \u041f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043d\u043e \u043e \u0442\u043e\u043c \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 ABI\u2011\u0440\u0430\u0437\u0440\u044b\u0432 \u0438\u043b\u0438 ABI\u2011\u043d\u0435\u0441\u043e\u0432\u043c\u0435\u0442\u0438\u043c\u043e\u0441\u0442\u044c. ABI\u2011\u0440\u0430\u0437\u0440\u044b\u0432 &#8212; \u044d\u0442\u043e \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f, \u043a\u043e\u0433\u0434\u0430 \u0434\u0432\u0430 \u0438 \u0431\u043e\u043b\u0435\u0435 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u043e\u0434\u043d\u0438\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043f\u043e-\u0440\u0430\u0437\u043d\u043e\u043c\u0443. \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e \u0432 \u043a\u043e\u0444\u0435\u0439\u043d\u0435, \u0432\u044b \u0437\u0430\u043a\u0430\u0437\u0430\u043b\u0438 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043a\u043e\u0444\u0435, \u0431\u0430\u0440\u0438\u0441\u0442\u0430 \u0433\u043e\u0442\u043e\u0432\u0438\u0442 \u043d\u0443\u0436\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043c, \u043d\u043e \u0441\u0442\u0430\u0436\u0435\u0440 \u043f\u043e\u0434\u0430\u0435\u0442 \u0435\u043c\u0443 \u0441\u0442\u0430\u043a\u0430\u043d \u043c\u0435\u043d\u044c\u0448\u0435\u0433\u043e \u043e\u0431\u044a\u0435\u043c\u0430, \u043a\u0430\u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b \u043b\u0438\u0431\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u043c\u0435\u043d\u044c\u0448\u0435 \u043a\u043e\u0444\u0435, \u043b\u0438\u0431\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442 \u043f\u043e\u0442\u0435\u0440\u044f \u0446\u0435\u043d\u043d\u044b\u0445 \u043c\u0438\u043b\u043b\u0438\u043b\u0438\u0442\u0440\u043e\u0432. \u042d\u0442\u043e \u0438 \u0435\u0441\u0442\u044c ABI\u2011\u0440\u0430\u0437\u0440\u044b\u0432, \u043e\u0434\u0438\u043d \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0435\u0431\u0435 \u0440\u0430\u0431\u043e\u0442\u0443 \u043d\u0435 \u0442\u0430\u043a \u043a\u0430\u043a \u0434\u0440\u0443\u0433\u043e\u0439 \u0438 \u043d\u0430 \u0441\u0442\u044b\u043a\u0435 \u0438\u0445 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0441\u044f \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0435 \u0437\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u043b\u043e\u0441\u044c \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e.<\/p>\n<p><strong>\u0418\u0437 \u043a\u043e\u0444\u0435\u0439\u043d\u0438 \u043a \u043a\u043e\u0434\u0443<\/strong><\/p>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0442\u0440\u0443\u0434\u0438\u0442\u0441\u044f \u043d\u0430\u0434 \u043e\u0434\u043d\u0438\u043c \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u043e\u043c, \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0440\u0430\u0437\u043d\u0435\u0441\u0435\u043d\u044b \u043d\u0430 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0435\u0432. \u0412\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u0443\u0441\u043a\u0430 \u043d\u043e\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430 \u0431\u0438\u043b\u0434-\u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u0432\u0441\u0435 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0438 \u0441\u043b\u0438\u0432\u0430\u0435\u0442 \u0432\u0441\u0451 \u0432 \u043e\u0434\u043d\u0443 \u0440\u0430\u0431\u043e\u0447\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443. \u0414\u043b\u044f \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u043b\u044e\u0431\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0431\u0435\u0437 \u043f\u0435\u0440\u0435\u0441\u0431\u043e\u0440\u043a\u0438 \u0432\u0441\u0435\u0433\u043e \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0433\u043e.<\/p>\n<p>\u041e\u043f\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0431\u0443\u0434\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0441 4-\u043c\u044f \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f\u043c\u0438:<\/p>\n<ol>\n<li>\n<p>\u0410\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u0430\u044f \u043a\u043e\u0444\u0435\u0439\u043d\u044f, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u0430\u044f \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 \u043d\u0430 \u0421.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0431\u0430\u0440\u0438\u0441\u0442\u0430, \u043f\u043e\u0434\u0433\u0440\u0443\u0436\u0430\u0435\u043c\u044b\u0439 \u0432 \u0432\u0438\u0434\u0435 \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u043a \u0434\u0432\u0438\u0436\u043a\u0443.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043b\u0430\u0433\u0438\u043d \u0441\u0442\u0430\u0436\u0435\u0440\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043e \u0441\u0442\u0430\u043a\u0430\u043d\u0447\u0438\u043a\u0430\u043c\u0438.<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"bash\">&gt; tree\u251c\u2500\u2500 build_run.sh\u251c\u2500\u2500 coffee_shop\u2502   \u2514\u2500\u2500 coffee_shop.c\u251c\u2500\u2500 cuplib\u2502   \u2514\u2500\u2500 cup.h\u251c\u2500\u2500 plugin_barista\u2502   \u251c\u2500\u2500 api.h\u2502   \u2514\u2500\u2500 plugin_barista.c\u2514\u2500\u2500 plugin_intern    \u2514\u2500\u2500 plugin_intern.c<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper\"><\/span><\/a><\/div><\/pre>\n<p>\u041f\u043b\u0430\u0433\u0438\u043d\u044b \u043a \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c\u0443 \u0434\u0432\u0438\u0436\u043a\u0443 \u043f\u043e\u0434\u0433\u0440\u0443\u0436\u0430\u044e\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <em>libdl<\/em>.<\/p>\n<p>plugin_barista &#8212; \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 API, \u0432 \u0432\u0438\u0434\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0441 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f\u043c\u0438 \u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u0444\u0435\u0439\u043d\u044b\u043c \u0446\u0435\u0445\u043e\u043c. \u0414\u0440\u0443\u0433\u0438\u0435 \u043f\u043b\u0430\u0433\u0438\u043d\u044b \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u044e\u0442 \u044d\u0442\u0443 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0434\u043b\u044f \u0441\u0432\u043e\u0438\u0445 \u043d\u0443\u0436\u0434.<\/p>\n<p><strong>\u041c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 ABI\u2011\u0440\u0430\u0437\u0440\u044b\u0432\u0430<\/strong><\/p>\n<p>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043e \u0441\u0442\u0430\u043a\u0430\u043d\u0447\u0438\u043a\u0430\u043c\u0438 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 &#8212; \u0441\u0442\u0430\u043a\u0430\u043d\u0447\u0438\u043a.<\/p>\n<pre><code class=\"cpp\">\/\/ cuplib\/cup.h#pragma oncetypedef struct cup_s {  \/\/...} cup_t;<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u041e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 API \u0431\u0430\u0440\u0438\u0441\u0442\u044b.<\/p>\n<pre><code class=\"cpp\">\/\/ plugin_barista\/api.h#pragma once#include &lt;stdbool.h&gt;#include &lt;cuplib\/cup.h&gt;\/\/ \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 APItypedef struct barista_plugin_api_s {    void        (*make_coffee)(void); \/\/ \u041f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u043a\u043e\u0444\u0435    void        (*pour_coffee)(cup_t* cup); \/\/ \u041d\u0430\u043b\u0438\u0442\u044c \u043a\u043e\u0444\u0435    bool        (*is_coffee_ready)(void); \/\/ \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 true, \u0435\u0441\u043b\u0438 \u043a\u043e\u0444\u0435 \u0433\u043e\u0442\u043e\u0432\u043e} barista_plugin_api_t;extern const barista_plugin_api_t *get_barista_plugin_api(void);<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u0425\u043e\u0440\u043e\u0448\u0435\u0439 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u043e\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435 \u0432\u044b\u043d\u043e\u0441\u0438\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u0432 API, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0439 API \u043a\u043e\u0434 \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0435\u043b \u043e\u0442 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440 \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438\u0437\u0432\u043d\u0435, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u0441\u0435 \u0442\u0438\u043f\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u044b\u043c\u0438, \u0430 \u0432\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u0430 \u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 \u043f\u043b\u0430\u0433\u0438\u043d\u0430.<\/p>\n<pre><code class=\"cpp\">\/\/ plugin_barista\/plugin_barista.c#include &lt;stdio.h&gt;#include &lt;plugin_barista\/api.h&gt;\/\/ \u0424\u043b\u0430\u0433 \u0433\u043e\u0442\u043e\u0432\u043d\u043e\u0441\u0442\u0438 \u043a\u043e\u0444\u0435static bool g_is_coffee_ready = false;void make_coffee_fn(void) {     g_is_coffee_ready = false;     printf(\"Called make_coffee_fn\\n\"); };static void pour_coffee_fn(cup_t* cup) {     printf(\"Called pour_coffee_fn, g_is_coffee_ready = %s\\n\", g_is_coffee_ready ? \"true\" : \"false\"); };static bool is_coffee_ready_fn(void) {     \/\/ \u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043d\u0430 \u0442\u0440\u0435\u0442\u0438\u0439 \u0440\u0430\u0437 \u0432\u044b\u0437\u043e\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0444\u0435 \u0433\u043e\u0442\u043e\u0432\u043e    static unsigned char call_counter = 0;    if (++call_counter == 3) {        call_counter = 0;        g_is_coffee_ready = true;    }    printf(\"Called is_coffee_ready_fn, g_is_coffee_ready = %s\\n\", g_is_coffee_ready ? \"true\" : \"false\");    return g_is_coffee_ready; };\/\/ \u0417\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b APIstatic barista_plugin_api_t barista_plugin_api = {    .make_coffee = make_coffee_fn,    .pour_coffee = pour_coffee_fn,    .is_coffee_ready = is_coffee_ready_fn,};\/\/ \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0430 APIconst barista_plugin_api_t *get_barista_plugin_api(void) {    return &amp;barista_plugin_api;}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u0421 plugin_intern \u0432\u0441\u0451 \u043f\u0440\u043e\u0441\u0442\u043e. \u042d\u043a\u0441\u043f\u043e\u0440\u0438\u0442\u0440\u0443\u0435\u043c API, \u0434\u0430\u043b\u0435\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0435\u0441\u043b\u0438 \u043a\u043e\u0444\u0435 \u0433\u043e\u0442\u043e\u0432\u043e, \u043d\u0430\u043b\u0438\u0432\u0430\u0435\u043c.<\/p>\n<pre><code class=\"cpp\">\/\/ plugin_intern\/plugin_intern.c#include &lt;stdio.h&gt;#include &lt;plugin_barista\/api.h&gt;bool intern_work(cup_t* cup) {    const barista_plugin_api_t *api = get_barista_plugin_api();    if (api-&gt;is_coffee_ready()) {        api-&gt;pour_coffee(cup);        return true;    }    printf(\"Coffee not ready\\n\");    return false;}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u0432\u0438\u0436\u043a\u0430.<\/p>\n<pre><code class=\"cpp\">\/\/ coffee_shop\/coffee_shop.c#include &lt;stdio.h&gt;#include &lt;unistd.h&gt;#include &lt;dlfcn.h&gt;#include &lt;plugin_barista\/api.h&gt;#include &lt;cuplib\/cup.h&gt;int main(int agrc, char **argv) {    \/\/ \u041f\u043e\u0434\u0433\u0440\u0443\u0436\u0430\u0435\u043c plugin_barista, RTLD_GLOBAL \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f     \/\/ get_barista_plugin_api \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u043e\u0434\u0433\u0440\u0443\u0436\u0430\u0435\u043c\u044b\u0445 \u043f\u043b\u0430\u0433\u0438\u043d\u0430\u0445    void *plugin_barista = dlopen(\".\/plugin_barista.so\", RTLD_NOW | RTLD_GLOBAL);    if (!plugin_barista) { fprintf(stderr, \"dlopen plugin_barista: %s\\n\", dlerror()); return 1; }    \/\/ \u041f\u043e\u0434\u0433\u0440\u0443\u0436\u0430\u0435\u043c plugin_intern    void *plugin_intern = dlopen(\".\/plugin_intern.so\", RTLD_NOW);    if (!plugin_intern) { fprintf(stderr, \"dlopen plugin_intern: %s\\n\", dlerror()); return 1; }    \/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0438    bool (*intern_work)(cup_t* cup) = dlsym(plugin_intern, \"intern_work\");    void (*make_coffee)(void) = dlsym(plugin_barista, \"make_coffee_fn\");    if (!intern_work) { fprintf(stderr, \"dlopen: %s\\n\",  dlerror()); return 1; }    \/\/ \u041c\u043e\u0434\u0435\u043b\u0438\u0440\u0443\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0443 \u043a\u043e\u0444\u0435\u0439\u043d\u0438    \/\/ \u0417\u0430\u043a\u0430\u0437 \u043a\u043e\u0444\u0435    \/\/ \u0411\u0430\u0440\u0438\u0441\u0442\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0433\u043e\u0442\u043e\u0432\u043a\u0443    make_coffee();    \/\/ \u041f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0432\u0440\u0435\u043c\u044f, \u0441\u0442\u0430\u0436\u0435\u0440 5 \u0440\u0430\u0437 \u043e\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u043e \u0433\u043e\u0442\u043e\u0432\u043d\u043e\u0441\u0442\u0438 \u0438     \/\/ \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u043b\u0438\u0442\u044c \u043a\u043e\u0444\u0435, \u0435\u0441\u043b\u0438 \u043a\u043e\u0444\u0435 \u043d\u0430\u043b\u0438\u0442\u043e \u0446\u0438\u043a\u043b \u043f\u0440\u0435\u043a\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f    cup_t cup;    for (size_t i = 0; i &lt; 5; ++i) {         if (intern_work(&amp;cup)) {            break;        }    }    \/\/ \u041e\u0442\u0434\u0430\u0435\u043c \u043a\u043e\u0444\u0435    return 0;}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u0443\u043b\u0447\u0435\u0439\u043d <em>GCC<\/em>, \u043d\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0439 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0432\u0430\u043c. \u0412\u0441\u044f \u0441\u0431\u043e\u0440\u043a\u0430 \u0438 \u0437\u0430\u043f\u0443\u0441\u043a \u043e\u0431\u044a\u0435\u0434\u0435\u043d\u0438\u043d\u044b \u0432 \u043e\u0434\u0438\u043d bash \u0441\u043a\u0440\u0438\u043f\u0442. \u0424\u043b\u0430\u0433\u0438 <strong>-g<\/strong> \u0438 <strong>-O0 <\/strong>\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u0432 \u0434\u0435\u0431\u0430\u0433\u0435\u0440\u0435.<\/p>\n<pre><code class=\"bash\"># !\/bin\/bashif [ -e \"build\" ]; then    rm -rf buildfi# \u0421\u0431\u043e\u0440\u043e\u0447\u043d\u0430\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044fmkdir build# \u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u043b\u0430\u0433\u0438\u043d \u0431\u0430\u0440\u0438\u0441\u0442\u044bgcc -c -fPIC plugin_barista\/plugin_barista.c -g -O0 -I . --warn-all -o build\/plugin_barista.o &amp;&amp; gcc -shared -o build\/plugin_barista.so build\/plugin_barista.orm build\/plugin_barista.o# \u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u043b\u0430\u0433\u0438\u043d \u0441\u0442\u0430\u0436\u0435\u0440\u0430gcc -c -fPIC plugin_intern\/plugin_intern.c -g -O0 -I . --warn-all -o build\/plugin_intern.o &amp;&amp; gcc -shared -o build\/plugin_intern.so build\/plugin_intern.orm build\/plugin_intern.o# \u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0434\u0432\u0438\u0436\u0435\u043agcc coffee_shop\/coffee_shop.c -g -O0 --warn-all -ldl -I . -o build\/coffee_shop# \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043ccd build\/ &amp;&amp; .\/coffee_shop<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u0414\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c:<\/p>\n<pre><code class=\"bash\">chmod +x build_run.sh<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u041e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 STDOUT \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0438 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0442:<\/p>\n<pre><code class=\"bash\">&gt;Called make_coffee_fn&gt;Called is_coffee_ready_fn, g_is_coffee_ready = false&gt;Coffee not ready&gt;Called is_coffee_ready_fn, g_is_coffee_ready = false&gt;Coffee not ready&gt;Called is_coffee_ready_fn, g_is_coffee_ready = true&gt;Called pour_coffee_fn, g_is_coffee_ready = true<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u041d\u043e, \u0432 \u043a\u043e\u0444\u0435\u0439\u043d\u044e \u043d\u0430\u0433\u0440\u044f\u043d\u0443\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u043f\u043e\u0432\u0438\u043b\u043e\u0441\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0438\u0434\u043e\u0432 \u0441\u0442\u0430\u043a\u0430\u043d\u043e\u0432 \u0440\u0430\u0437\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043c\u0430, API \u0431\u0430\u0440\u0438\u0441\u0442\u044b \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f, \u043d\u043e \u0441\u0442\u0430\u0436\u0435\u0440 \u043e\u0431 \u044d\u0442\u043e\u043c \u043d\u0435 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d&#8230;<\/p>\n<p><em>is_coffee_ready_fn<\/em> \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u043b\u0436\u043d\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043d\u0435 <em>bool<\/em>, \u0430 \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u0442\u0430\u043a\u0430\u043d\u0447\u0438\u043a\u0430 \u043f\u0440\u0438 \u0433\u043e\u0442\u043e\u0432\u043d\u043e\u0441\u0442\u0438 \u0438 0, \u0435\u0441\u043b\u0438 \u043a\u043e\u0444\u0435 \u043d\u0435 \u0433\u043e\u0442\u043e\u0432\u043e.<\/p>\n<p>\u041d\u0438\u0436\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043d\u043e\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 API.<\/p>\n<pre><code class=\"cpp\">\/\/ plugin_barista\/api.h#pragma once#include &lt;stdbool.h&gt;#include &lt;cuplib\/cup.h&gt;\/\/ \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 APItypedef struct barista_plugin_api_s {    void        (*make_coffee)(void); \/\/ \u041f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u043a\u043e\u0444\u0435    void        (*pour_coffee)(cup_t* cup); \/\/ \u041d\u0430\u043b\u0438\u0442\u044c \u043a\u043e\u0444\u0435    unsigned short        (*is_coffee_ready)(void); \/\/ \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043c \u0435\u0441\u043b\u0438 \u043a\u043e\u0444\u0435 \u0433\u043e\u0442\u043e\u0432\u043e, \u0438\u043d\u0430\u0447\u0435 0} barista_plugin_api_t;extern const barista_plugin_api_t *get_barista_plugin_api(void);<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e API.<\/p>\n<pre><code class=\"cpp\">\/\/ plugin_barista\/plugin_barista.c#include &lt;stdio.h&gt;#include &lt;plugin_barista\/api.h&gt;\/\/ \u0424\u043b\u0430\u0433 \u0433\u043e\u0442\u043e\u0432\u043d\u043e\u0441\u0442\u0438 \u043a\u043e\u0444\u0435static bool g_is_coffee_ready = false;void make_coffee_fn(void) {     g_is_coffee_ready = false;     printf(\"Called make_coffee_fn\\n\"); };static void pour_coffee_fn(cup_t* cup) {     printf(\"Called pour_coffee_fn, g_is_coffee_ready = %s\\n\", g_is_coffee_ready ? \"true\" : \"false\"); };static unsigned short is_coffee_ready_fn(void) {     \/\/ \u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043d\u0430 \u0442\u0440\u0435\u0442\u0438\u0439 \u0440\u0430\u0437 \u0432\u044b\u0437\u043e\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0444\u0435 \u0433\u043e\u0442\u043e\u0432\u043e    static unsigned char call_counter = 0;    if (++call_counter == 3) {        call_counter = 0;        g_is_coffee_ready = true;    }    printf(\"Called is_coffee_ready_fn, g_is_coffee_ready = %s\\n\", g_is_coffee_ready ? \"true\" : \"false\");    return g_is_coffee_ready ? 330 \/* \u0418\u043b\u0438 \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 \u043e\u0431\u044a\u0435\u043c *\/ : 0; };\/\/ \u0417\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b APIstatic barista_plugin_api_t barista_plugin_api = {    .make_coffee = make_coffee_fn,    .pour_coffee = pour_coffee_fn,    .is_coffee_ready = is_coffee_ready_fn,};\/\/ \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0430 APIconst barista_plugin_api_t *get_barista_plugin_api(void) {    return &amp;barista_plugin_api;}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u043b\u0430\u0433\u0438\u043d \u0431\u0430\u0440\u0438\u0441\u0442\u044b \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c.<\/p>\n<pre><code class=\"bash\">gcc -c -fPIC plugin_barista\/plugin_barista.c -g -O0 -I . --warn-all -o build\/plugin_barista.o &amp;&amp; gcc -shared -o build\/plugin_barista.so build\/plugin_barista.o &amp;&amp; rm build\/plugin_barista.o &amp;&amp; cd build\/ &amp;&amp; .\/coffee_shop<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u0412\u044b\u0432\u043e\u0434 \u0432 STDOUT \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0439, \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u0442\u0430\u0436\u0435\u0440 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u0442 \u0442\u0440\u0430\u043a\u0442\u043e\u0432\u0430\u0442\u044c \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <em>is_coffee_ready_fn<\/em> \u043a\u0430\u043a \u0444\u043b\u0430\u0433 \u0433\u043e\u0442\u043e\u0432\u043e\/\u043d\u0435 \u0433\u043e\u0442\u043e\u0432\u043e, \u043a\u0430\u043a \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435 \u043c\u044b \u043d\u0435 \u0434\u043e\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u043b\u0438 \u0442\u0435\u0440\u044f\u0435\u043c \u043d\u0443\u0436\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043c\u00a0\u043d\u0430\u043f\u0438\u0442\u043a\u0430.<br \/>\u041e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0432\u044b\u0448\u0435 \u043f\u0440\u0438\u043c\u0435\u0440 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u044f\u0433\u043a\u043e\u0439 \u0444\u043e\u0440\u043c\u043e\u0439 ABI\u2011\u0440\u0430\u0437\u0440\u044b\u0432\u0430. \u0412 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0436\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445 \u043e\u0448\u0438\u0431\u043a\u0438 \u043c\u043e\u0433\u0443\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0442\u044c \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u0435\u0435. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0438\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u043f\u043e\u0440\u0442\u0438\u0442\u044c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u0435\u0439 \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435.<\/p>\n<pre><code class=\"cpp\">\/\/ \u0411\u044b\u043b\u043estruct API { A_fn; B_fn; C_fn; };<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043d\u043e\u0432\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432 \u043d\u0430\u0447\u0430\u043b\u043e.<\/p>\n<pre><code class=\"cpp\">\/\/ \u0421\u0442\u0430\u043b\u043estruct API { D_fn; A_fn; B_fn; C_fn; };<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u0411\u0435\u0437 \u043f\u0435\u0440\u0435\u0441\u0431\u043e\u0440\u043a\u0438 \u0432\u0441\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0439 API \u043a\u043e\u0434, \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c \u043f\u043e \u0441\u0442\u0430\u0440\u044b\u043c \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f\u043c \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435, \u043b\u0443\u0447\u0448\u0438\u0439 \u0438\u0441\u0445\u043e\u0434 &#8212; \u044d\u0442\u043e \u043f\u0430\u0434\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. \u0412 \u0445\u0443\u0434\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u0432\u044b\u0434\u0430\u0432\u0430\u044f \u043d\u0435\u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u043c\u0435\u0441\u0442\u0430\u0445.<\/p>\n<p>\u0415\u0449\u0451 \u043e\u0434\u043d\u0438\u043c \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435\u043c ABI\u2011\u0440\u0430\u0437\u0440\u044b\u0432\u0430 \u043c\u043e\u0436\u0435\u0442 \u0441\u0442\u0430\u0442\u044c \u043f\u043e\u0432\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u043a\u0443\u0447\u0438, \u043a\u043e\u0433\u0434\u0430 \u0438\u0437-\u0437\u0430 \u0440\u0430\u0441\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0435 \u0441\u0442\u0440\u043a\u0443\u0442\u0443\u0440, \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0438\u043b\u0438 \u0437\u0430\u0442\u0438\u0440\u0430\u044e\u0442\u0441\u044f \u0443\u0447\u0430\u0441\u0442\u043a\u0438 \u043f\u0430\u043c\u044f\u0442\u0438 \u0441\u043e \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0439 \u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0430\u043b\u043b\u043e\u043a\u0430\u0442\u043e\u0440\u0430:<\/p>\n<pre><code class=\"cpp\">\/* engine_old.c \u2014 \u0441\u043e\u0431\u0440\u0430\u043d \u0441\u043e \u0441\u0442\u0430\u0440\u044b\u043c api.h *\/#include &lt;stdlib.h&gt;#include &lt;stdio.h&gt;#include &lt;api.h&gt;extern void fill_api(struct plugin_api *out);     \/* \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u0432 \u043d\u043e\u0432\u043e\u043c API *\/int main(void) {    struct plugin_api *p = calloc(1, sizeof(*p)); \/* \u0441\u0442\u0430\u0440\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c 24*\/    fill_api(p);                                  \/* \u043d\u043e\u0432\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 32 \u0431\u0430\u0439\u0442\u0430 *\/    \/* \u0412 \u044d\u0442\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u043a\u0443\u0447\u0430 \u0443\u0436\u0435 \u043f\u043e\u0432\u0440\u0435\u0436\u0434\u0435\u043d\u0430 *\/    char *s = malloc(32);    \/\/ \u0414\u0430\u043b\u0435\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e, \u0432\u0441\u0451 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0430\u043b\u043b\u043e\u043a\u0430\u0442\u043e\u0440\u0430 \u0438\u043b\u0438 \u043e\u0442 \u043f\u043e\u0433\u043e\u0434\u044b \u0437\u0430 \u043e\u043a\u043d\u043e\u043c    free(s); \/* \u043c\u043e\u0436\u0435\u0442 \u0443\u043f\u0430\u0441\u0442\u044c \u0442\u0443\u0442 *\/    printf(\"Hello!\\n\"); \/* \u0438\u043b\u0438 \u0442\u0443\u0442 *\/    return 0;}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u0432\u044b\u0448\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u043c\u044b\u043c API, \u043d\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0442\u044c \u0438 \u0434\u043b\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0435.<\/p>\n<p><strong>\u041a\u0430\u043a \u0438\u0437\u0431\u0435\u0433\u0430\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0439<\/strong><\/p>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0435 <em>version<\/em> \u0432 \u043d\u0430\u0447\u0430\u043b\u043e \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u043c\u044b\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440. \u0412\u0441\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f \u043a \u0434\u0430\u043d\u043d\u044b\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430\u043c, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442 \u043f\u043e\u043b\u0435 version \u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u0441\u043e \u0441\u0432\u043e\u0435\u0439 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u043f\u0438\u0435\u0439 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043e\u0439 \u0438\u0437 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0440\u0430\u0441\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0432\u0435\u0440\u0441\u0438\u0439, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0430\u0432\u0430\u0440\u0438\u0439\u043d\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u0440\u0438 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0438 \u043a \u0434\u0430\u043d\u043d\u044b\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430\u043c \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c.<\/p>\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\/articles\/1090188\/\">https:\/\/habr.com\/ru\/articles\/1090188\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u041d\u0438 \u0434\u043b\u044f \u043a\u043e\u0433\u043e \u043d\u0435 \u0441\u0435\u043a\u0440\u0435\u0442, \u0447\u0442\u043e \u0432 \u044f\u0437\u044b\u043a\u0435 C \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u0432\u0430\u0448\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u0432\u044b\u0442\u0435\u043a\u0430\u044e\u0449\u0438\u043c\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u044f\u043c\u0438, \u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0438\u0437 \u043d\u0438\u0445 \u043e\u0431\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0431\u0430\u043d\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 \u0433\u0438\u0433\u0438\u0435\u043d\u044b, \u0441\u0430\u043d\u0438\u0442\u0430\u0439\u0437\u0435\u0440\u0430\u043c\u0438, \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430\u043c\u0438, \u043b\u0438\u043d\u0442\u0435\u0440\u0430\u043c\u0438, \u0434\u0430 \u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u044b \u0432 \u0446\u0435\u043b\u043e\u043c \u043d\u0435 \u043f\u043b\u043e\u0445\u043e \u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0442 \u0440\u0435\u0448\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0434\u043e \u0438\u0445 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0435. \u041d\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0438 \u043f\u043e\u043d\u044f\u0442\u044c, \u0432 \u0447\u0435\u043c \u043f\u0440\u0438\u0447\u0438\u043d\u0430, \u043d\u0435 \u0442\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u043e, \u0445\u043e\u0442\u044f \u0441\u0430\u043c\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u043c\u043e\u0436\u0435\u0442 \u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u0434\u0430\u0436\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e\u0439 \u043f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u0447\u0438\u043d\u043d\u043e-\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0441\u0432\u044f\u0437\u0438.\u041e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0442\u043e\u043c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 ABI, \u044f \u043d\u0435 \u0431\u0443\u0434\u0443, \u0434\u0430\u0431\u044b \u043d\u0435 \u0440\u0430\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u043b\u0438\u0448\u043d\u044e\u044e \u043f\u043e\u043b\u0435\u043c\u0438\u043a\u0443, \u043d\u0430 \u0425\u0430\u0431\u0440\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u0442\u0430\u0442\u0435\u0439 \u043d\u0430 \u044d\u0442\u0443 \u0442\u0435\u043c\u0443. \u041f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043d\u043e \u043e \u0442\u043e\u043c \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 ABI\u2011\u0440\u0430\u0437\u0440\u044b\u0432 \u0438\u043b\u0438 ABI\u2011\u043d\u0435\u0441\u043e\u0432\u043c\u0435\u0442\u0438\u043c\u043e\u0441\u0442\u044c. ABI\u2011\u0440\u0430\u0437\u0440\u044b\u0432 &#8212; \u044d\u0442\u043e \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f, \u043a\u043e\u0433\u0434\u0430 \u0434\u0432\u0430 \u0438 \u0431\u043e\u043b\u0435\u0435 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u043e\u0434\u043d\u0438\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043f\u043e-\u0440\u0430\u0437\u043d\u043e\u043c\u0443. \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e \u0432 \u043a\u043e\u0444\u0435\u0439\u043d\u0435, \u0432\u044b \u0437\u0430\u043a\u0430\u0437\u0430\u043b\u0438 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043a\u043e\u0444\u0435, \u0431\u0430\u0440\u0438\u0441\u0442\u0430 \u0433\u043e\u0442\u043e\u0432\u0438\u0442 \u043d\u0443\u0436\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043c, \u043d\u043e \u0441\u0442\u0430\u0436\u0435\u0440 \u043f\u043e\u0434\u0430\u0435\u0442 \u0435\u043c\u0443 \u0441\u0442\u0430\u043a\u0430\u043d \u043c\u0435\u043d\u044c\u0448\u0435\u0433\u043e \u043e\u0431\u044a\u0435\u043c\u0430, \u043a\u0430\u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b \u043b\u0438\u0431\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u043c\u0435\u043d\u044c\u0448\u0435 \u043a\u043e\u0444\u0435, \u043b\u0438\u0431\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442 \u043f\u043e\u0442\u0435\u0440\u044f \u0446\u0435\u043d\u043d\u044b\u0445 \u043c\u0438\u043b\u043b\u0438\u043b\u0438\u0442\u0440\u043e\u0432. \u042d\u0442\u043e \u0438 \u0435\u0441\u0442\u044c ABI\u2011\u0440\u0430\u0437\u0440\u044b\u0432, \u043e\u0434\u0438\u043d \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0435\u0431\u0435 \u0440\u0430\u0431\u043e\u0442\u0443 \u043d\u0435 \u0442\u0430\u043a \u043a\u0430\u043a \u0434\u0440\u0443\u0433\u043e\u0439 \u0438 \u043d\u0430 \u0441\u0442\u044b\u043a\u0435 \u0438\u0445 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0441\u044f \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0435 \u0437\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u043b\u043e\u0441\u044c \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e.\u0418\u0437 \u043a\u043e\u0444\u0435\u0439\u043d\u0438 \u043a \u043a\u043e\u0434\u0443\u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0442\u0440\u0443\u0434\u0438\u0442\u0441\u044f \u043d\u0430\u0434 \u043e\u0434\u043d\u0438\u043c \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u043e\u043c, \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0440\u0430\u0437\u043d\u0435\u0441\u0435\u043d\u044b \u043d\u0430 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0435\u0432. \u0412\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u0443\u0441\u043a\u0430 \u043d\u043e\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0430 \u0431\u0438\u043b\u0434-\u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u0432\u0441\u0435 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0438 \u0441\u043b\u0438\u0432\u0430\u0435\u0442 \u0432\u0441\u0451 \u0432 \u043e\u0434\u043d\u0443 \u0440\u0430\u0431\u043e\u0447\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443. \u0414\u043b\u044f \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u043b\u044e\u0431\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0431\u0435\u0437 \u043f\u0435\u0440\u0435\u0441\u0431\u043e\u0440\u043a\u0438 \u0432\u0441\u0435\u0433\u043e \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0433\u043e.\u041e\u043f\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0431\u0443\u0434\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0441 4-\u043c\u044f \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f\u043c\u0438:\u0410\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u0430\u044f \u043a\u043e\u0444\u0435\u0439\u043d\u044f, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u0430\u044f \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 \u043d\u0430 \u0421.\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0431\u0430\u0440\u0438\u0441\u0442\u0430, \u043f\u043e\u0434\u0433\u0440\u0443\u0436\u0430\u0435\u043c\u044b\u0439 \u0432 \u0432\u0438\u0434\u0435 \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u043a \u0434\u0432\u0438\u0436\u043a\u0443.\u041f\u043b\u0430\u0433\u0438\u043d \u0441\u0442\u0430\u0436\u0435\u0440\u0430.\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043e \u0441\u0442\u0430\u043a\u0430\u043d\u0447\u0438\u043a\u0430\u043c\u0438.&gt; tree\u251c\u2500\u2500 build_run.sh\u251c\u2500\u2500 coffee_shop\u2502   \u2514\u2500\u2500 coffee_shop.c\u251c\u2500\u2500 cuplib\u2502   \u2514\u2500\u2500 cup.h\u251c\u2500\u2500 plugin_barista\u2502   \u251c\u2500\u2500 api.h\u2502   \u2514\u2500\u2500 plugin_barista.c\u2514\u2500\u2500 plugin_intern    \u2514\u2500\u2500 plugin_intern.c\u041f\u043b\u0430\u0433\u0438\u043d\u044b \u043a \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c\u0443 \u0434\u0432\u0438\u0436\u043a\u0443 \u043f\u043e\u0434\u0433\u0440\u0443\u0436\u0430\u044e\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 libdl.plugin_barista &#8212; \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 API, \u0432 \u0432\u0438\u0434\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0441 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f\u043c\u0438 \u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u0444\u0435\u0439\u043d\u044b\u043c \u0446\u0435\u0445\u043e\u043c. \u0414\u0440\u0443\u0433\u0438\u0435 \u043f\u043b\u0430\u0433\u0438\u043d\u044b \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u044e\u0442 \u044d\u0442\u0443 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0434\u043b\u044f \u0441\u0432\u043e\u0438\u0445 \u043d\u0443\u0436\u0434.\u041c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 ABI\u2011\u0440\u0430\u0437\u0440\u044b\u0432\u0430\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043e \u0441\u0442\u0430\u043a\u0430\u043d\u0447\u0438\u043a\u0430\u043c\u0438 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 &#8212; \u0441\u0442\u0430\u043a\u0430\u043d\u0447\u0438\u043a.\/\/ cuplib\/cup.h#pragma oncetypedef struct cup_s {  \/\/&#8230;} cup_t;\u041e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 API \u0431\u0430\u0440\u0438\u0441\u0442\u044b.\/\/ plugin_barista\/api.h#pragma once#include &lt;stdbool.h&gt;#include &lt;cuplib\/cup.h&gt;\/\/ \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 APItypedef struct barista_plugin_api_s {    void        (*make_coffee)(void); \/\/ \u041f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u043a\u043e\u0444\u0435    void        (*pour_coffee)(cup_t* cup); \/\/ \u041d\u0430\u043b\u0438\u0442\u044c \u043a\u043e\u0444\u0435    bool        (*is_coffee_ready)(void); \/\/ \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 true, \u0435\u0441\u043b\u0438 \u043a\u043e\u0444\u0435 \u0433\u043e\u0442\u043e\u0432\u043e} barista_plugin_api_t;extern const barista_plugin_api_t *get_barista_plugin_api(void);\u0425\u043e\u0440\u043e\u0448\u0435\u0439 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u043e\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435 \u0432\u044b\u043d\u043e\u0441\u0438\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u0432 API, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0439 API \u043a\u043e\u0434 \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0435\u043b \u043e\u0442 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440 \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438\u0437\u0432\u043d\u0435, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u0441\u0435 \u0442\u0438\u043f\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u044b\u043c\u0438, \u0430 \u0432\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u0430 \u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 \u043f\u043b\u0430\u0433\u0438\u043d\u0430.\/\/ plugin_barista\/plugin_barista.c#include &lt;stdio.h&gt;#include &lt;plugin_barista\/api.h&gt;\/\/ \u0424\u043b\u0430\u0433 \u0433\u043e\u0442\u043e\u0432\u043d\u043e\u0441\u0442\u0438 \u043a\u043e\u0444\u0435static bool g_is_coffee_ready = false;void make_coffee_fn(void) {     g_is_coffee_ready = false;     printf(&#171;Called make_coffee_fn\\n&#187;); };static void pour_coffee_fn(cup_t* cup) {     printf(&#171;Called pour_coffee_fn, g_is_coffee_ready = %s\\n&#187;, g_is_coffee_ready ? &#171;true&#187; : &#171;false&#187;); };static bool is_coffee_ready_fn(void) {     \/\/ \u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043d\u0430 \u0442\u0440\u0435\u0442\u0438\u0439 \u0440\u0430\u0437 \u0432\u044b\u0437\u043e\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0444\u0435 \u0433\u043e\u0442\u043e\u0432\u043e    static unsigned char call_counter = 0;    if (++call_counter == 3) {        call_counter = 0;        g_is_coffee_ready = true;    }    printf(&#171;Called is_coffee_ready_fn, g_is_coffee_ready = %s\\n&#187;, g_is_coffee_ready ? &#171;true&#187; : &#171;false&#187;);    return g_is_coffee_ready; };\/\/ \u0417\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b APIstatic barista_plugin_api_t barista_plugin_api = {    .make_coffee = make_coffee_fn,    .pour_coffee = pour_coffee_fn,    .is_coffee_ready = is_coffee_ready_fn,};\/\/ \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0430 APIconst barista_plugin_api_t *get_barista_plugin_api(void) {    return &amp;barista_plugin_api;}\u0421 plugin_intern \u0432\u0441\u0451 \u043f\u0440\u043e\u0441\u0442\u043e. \u042d\u043a\u0441\u043f\u043e\u0440\u0438\u0442\u0440\u0443\u0435\u043c API, \u0434\u0430\u043b\u0435\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0435\u0441\u043b\u0438 \u043a\u043e\u0444\u0435 \u0433\u043e\u0442\u043e\u0432\u043e, \u043d\u0430\u043b\u0438\u0432\u0430\u0435\u043c.\/\/ plugin_intern\/plugin_intern.c#include &lt;stdio.h&gt;#include &lt;plugin_barista\/api.h&gt;bool intern_work(cup_t* cup) {    const barista_plugin_api_t *api = get_barista_plugin_api();    if (api-&gt;is_coffee_ready()) {        api-&gt;pour_coffee(cup);        return true;    }    printf(&#171;Coffee not ready\\n&#187;);    return false;}\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u0432\u0438\u0436\u043a\u0430.\/\/ coffee_shop\/coffee_shop.c#include &lt;stdio.h&gt;#include &lt;unistd.h&gt;#include &lt;dlfcn.h&gt;#include &lt;plugin_barista\/api.h&gt;#include &lt;cuplib\/cup.h&gt;int main(int agrc, char **argv) {    \/\/ \u041f\u043e\u0434\u0433\u0440\u0443\u0436\u0430\u0435\u043c plugin_barista, RTLD_GLOBAL \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f     \/\/ get_barista_plugin_api \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u043e\u0434\u0433\u0440\u0443\u0436\u0430\u0435\u043c\u044b\u0445 \u043f\u043b\u0430\u0433\u0438\u043d\u0430\u0445    void *plugin_barista = dlopen(&#171;.\/plugin_barista.so&#187;, RTLD_NOW | RTLD_GLOBAL);    if (!plugin_barista) { fprintf(stderr, &#171;dlopen plugin_barista: %s\\n&#187;, dlerror()); return 1; }    \/\/ \u041f\u043e\u0434\u0433\u0440\u0443\u0436\u0430\u0435\u043c plugin_intern    void *plugin_intern = dlopen(&#171;.\/plugin_intern.so&#187;, RTLD_NOW);    if (!plugin_intern) { fprintf(stderr, &#171;dlopen plugin_intern: %s\\n&#187;, dlerror()); return 1; }    \/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0438    bool (*intern_work)(cup_t* cup) = dlsym(plugin_intern, &#171;intern_work&#187;);    void (*make_coffee)(void) = dlsym(plugin_barista, &#171;make_coffee_fn&#187;);    if (!intern_work) { fprintf(stderr, &#171;dlopen: %s\\n&#187;,  dlerror()); return 1; }    \/\/ \u041c\u043e\u0434\u0435\u043b\u0438\u0440\u0443\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0443 \u043a\u043e\u0444\u0435\u0439\u043d\u0438    \/\/ \u0417\u0430\u043a\u0430\u0437 \u043a\u043e\u0444\u0435    \/\/ \u0411\u0430\u0440\u0438\u0441\u0442\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0433\u043e\u0442\u043e\u0432\u043a\u0443    make_coffee();    \/\/ \u041f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0432\u0440\u0435\u043c\u044f, \u0441\u0442\u0430\u0436\u0435\u0440 5 \u0440\u0430\u0437 \u043e\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u043e \u0433\u043e\u0442\u043e\u0432\u043d\u043e\u0441\u0442\u0438 \u0438     \/\/ \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u043b\u0438\u0442\u044c \u043a\u043e\u0444\u0435, \u0435\u0441\u043b\u0438 \u043a\u043e\u0444\u0435 \u043d\u0430\u043b\u0438\u0442\u043e \u0446\u0438\u043a\u043b \u043f\u0440\u0435\u043a\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f    cup_t cup;    for (size_t i = 0; i &lt; 5; ++i) {         if (intern_work(&amp;cup)) {            break;        }    }    \/\/ \u041e\u0442\u0434\u0430\u0435\u043c \u043a\u043e\u0444\u0435    return 0;}\u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u0443\u043b\u0447\u0435\u0439\u043d GCC, \u043d\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0439 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0432\u0430\u043c. \u0412\u0441\u044f \u0441\u0431\u043e\u0440\u043a\u0430 \u0438 \u0437\u0430\u043f\u0443\u0441\u043a \u043e\u0431\u044a\u0435\u0434\u0435\u043d\u0438\u043d\u044b \u0432 \u043e\u0434\u0438\u043d bash \u0441\u043a\u0440\u0438\u043f\u0442. \u0424\u043b\u0430\u0433\u0438 -g \u0438 -O0 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u0432 \u0434\u0435\u0431\u0430\u0433\u0435\u0440\u0435.# !\/bin\/bashif [ -e &#171;build&#187; ]; then    rm -rf buildfi# \u0421\u0431\u043e\u0440\u043e\u0447\u043d\u0430\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044fmkdir build# \u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u043b\u0430\u0433\u0438\u043d \u0431\u0430\u0440\u0438\u0441\u0442\u044bgcc -c -fPIC plugin_barista\/plugin_barista.c -g -O0 -I . &#8212;warn-all -o build\/plugin_barista.o &amp;&amp; gcc -shared -o build\/plugin_barista.so build\/plugin_barista.orm build\/plugin_barista.o# \u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u043b\u0430\u0433\u0438\u043d \u0441\u0442\u0430\u0436\u0435\u0440\u0430gcc -c -fPIC plugin_intern\/plugin_intern.c -g -O0 -I . &#8212;warn-all -o build\/plugin_intern.o &amp;&amp; gcc -shared -o build\/plugin_intern.so build\/plugin_intern.orm build\/plugin_intern.o# \u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0434\u0432\u0438\u0436\u0435\u043agcc coffee_shop\/coffee_shop.c -g -O0 &#8212;warn-all -ldl -I . -o build\/coffee_shop# \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043ccd build\/ &amp;&amp; .\/coffee_shop\u0414\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c:chmod +x build_run.sh\u041e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 STDOUT \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0438 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0442:&gt;Called make_coffee_fn&gt;Called is_coffee_ready_fn, g_is_coffee_ready = false&gt;Coffee not ready&gt;Called is_coffee_ready_fn, g_is_coffee_ready = false&gt;Coffee not ready&gt;Called is_coffee_ready_fn, g_is_coffee_ready = true&gt;Called pour_coffee_fn, g_is_coffee_ready = true\u041d\u043e, \u0432 \u043a\u043e\u0444\u0435\u0439\u043d\u044e \u043d\u0430\u0433\u0440\u044f\u043d\u0443\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u043f\u043e\u0432\u0438\u043b\u043e\u0441\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0438\u0434\u043e\u0432 \u0441\u0442\u0430\u043a\u0430\u043d\u043e\u0432 \u0440\u0430\u0437\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043c\u0430, API \u0431\u0430\u0440\u0438\u0441\u0442\u044b \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f, \u043d\u043e \u0441\u0442\u0430\u0436\u0435\u0440 \u043e\u0431 \u044d\u0442\u043e\u043c \u043d\u0435 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d&#8230;is_coffee_ready_fn \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u043b\u0436\u043d\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043d\u0435 bool, \u0430 \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u0442\u0430\u043a\u0430\u043d\u0447\u0438\u043a\u0430 \u043f\u0440\u0438 \u0433\u043e\u0442\u043e\u0432\u043d\u043e\u0441\u0442\u0438 \u0438 0, \u0435\u0441\u043b\u0438 \u043a\u043e\u0444\u0435 \u043d\u0435 \u0433\u043e\u0442\u043e\u0432\u043e.\u041d\u0438\u0436\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043d\u043e\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 API.\/\/ plugin_barista\/api.h#pragma once#include &lt;stdbool.h&gt;#include &lt;cuplib\/cup.h&gt;\/\/ \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 APItypedef struct barista_plugin_api_s {    void        (*make_coffee)(void); \/\/ \u041f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u043a\u043e\u0444\u0435    void        (*pour_coffee)(cup_t* cup); \/\/ \u041d\u0430\u043b\u0438\u0442\u044c \u043a\u043e\u0444\u0435    unsigned short        (*is_coffee_ready)(void); \/\/ \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043c \u0435\u0441\u043b\u0438 \u043a\u043e\u0444\u0435 \u0433\u043e\u0442\u043e\u0432\u043e, \u0438\u043d\u0430\u0447\u0435 0} barista_plugin_api_t;extern const barista_plugin_api_t *get_barista_plugin_api(void);\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e API.\/\/ plugin_barista\/plugin_barista.c#include &lt;stdio.h&gt;#include &lt;plugin_barista\/api.h&gt;\/\/ \u0424\u043b\u0430\u0433 \u0433\u043e\u0442\u043e\u0432\u043d\u043e\u0441\u0442\u0438 \u043a\u043e\u0444\u0435static bool g_is_coffee_ready = false;void make_coffee_fn(void) {     g_is_coffee_ready = false;     printf(&#171;Called make_coffee_fn\\n&#187;); };static void pour_coffee_fn(cup_t* cup) {     printf(&#171;Called pour_coffee_fn, g_is_coffee_ready = %s\\n&#187;, g_is_coffee_ready ? &#171;true&#187; : &#171;false&#187;); };static unsigned short is_coffee_ready_fn(void) {     \/\/ \u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043d\u0430 \u0442\u0440\u0435\u0442\u0438\u0439 \u0440\u0430\u0437 \u0432\u044b\u0437\u043e\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0444\u0435 \u0433\u043e\u0442\u043e\u0432\u043e    static unsigned char call_counter = 0;    if (++call_counter == 3) {        call_counter = 0;        g_is_coffee_ready = true;    }    printf(&#171;Called is_coffee_ready_fn, g_is_coffee_ready = %s\\n&#187;, g_is_coffee_ready ? &#171;true&#187; : &#171;false&#187;);    return g_is_coffee_ready ? 330 \/* \u0418\u043b\u0438 \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 \u043e\u0431\u044a\u0435\u043c *\/ : 0; };\/\/ \u0417\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b APIstatic barista_plugin_api_t barista_plugin_api = {    .make_coffee = make_coffee_fn,    .pour_coffee = pour_coffee_fn,    .is_coffee_ready = is_coffee_ready_fn,};\/\/ \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0430 APIconst barista_plugin_api_t *get_barista_plugin_api(void) {    return &amp;barista_plugin_api;}\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u043b\u0430\u0433\u0438\u043d \u0431\u0430\u0440\u0438\u0441\u0442\u044b \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c.gcc -c -fPIC plugin_barista\/plugin_barista.c -g -O0 -I . &#8212;warn-all -o build\/plugin_barista.o &amp;&amp; gcc -shared -o build\/plugin_barista.so build\/plugin_barista.o &amp;&amp; rm build\/plugin_barista.o &amp;&amp; cd build\/ &amp;&amp; .\/coffee_shop\u0412\u044b\u0432\u043e\u0434 \u0432 STDOUT \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0439, \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u0442\u0430\u0436\u0435\u0440 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u0442 \u0442\u0440\u0430\u043a\u0442\u043e\u0432\u0430\u0442\u044c \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 is_coffee_ready_fn \u043a\u0430\u043a \u0444\u043b\u0430\u0433 \u0433\u043e\u0442\u043e\u0432\u043e\/\u043d\u0435 \u0433\u043e\u0442\u043e\u0432\u043e, \u043a\u0430\u043a \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435 \u043c\u044b \u043d\u0435 \u0434\u043e\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u043b\u0438 \u0442\u0435\u0440\u044f\u0435\u043c \u043d\u0443\u0436\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043c\u00a0\u043d\u0430\u043f\u0438\u0442\u043a\u0430.\u041e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0432\u044b\u0448\u0435 \u043f\u0440\u0438\u043c\u0435\u0440 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u044f\u0433\u043a\u043e\u0439 \u0444\u043e\u0440\u043c\u043e\u0439 ABI\u2011\u0440\u0430\u0437\u0440\u044b\u0432\u0430. \u0412 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0436\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445 \u043e\u0448\u0438\u0431\u043a\u0438 \u043c\u043e\u0433\u0443\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0442\u044c \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u0435\u0435. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0438\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u043f\u043e\u0440\u0442\u0438\u0442\u044c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u0435\u0439 \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435.\/\/ \u0411\u044b\u043b\u043estruct API { A_fn; B_fn; C_fn; };\u0414\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043d\u043e\u0432\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-497281","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/497281","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=497281"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/497281\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=497281"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=497281"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=497281"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}