1
0

index.html 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564
  1. <!DOCTYPE html>
  2. <html lang="en" class="h-full">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width,initial-scale=1">
  6. <meta name="color-scheme" content="light dark">
  7. <meta name="turbo-cache-control" content="no-cache" data-turbo-track="reload" data-track-token="4.5.3.830753665642">
  8. <!-- See retype.com -->
  9. <meta name="generator" content="Retype 4.5.3">
  10. <!-- Primary Meta Tags -->
  11. <title>Write C++ Bindings | Portable Python 3.x Interpreter in Modern C</title>
  12. <meta name="title" content="Write C++ Bindings | Portable Python 3.x Interpreter in Modern C">
  13. <meta name="description" content="pkpy provides a pybind11 compatible layer which allows users to do convenient bindings. Header files are located in the include/pybind11 directory. Make sure you have added -Iinclude to your compiler flags.">
  14. <!-- Canonical -->
  15. <link rel="canonical" href="https://pocketpy.dev/bindings-cpp/">
  16. <link rel="sitemap" type="application/xml" title="Sitemap" href="https://pocketpy.dev/sitemap.xml">
  17. <!-- Open Graph -->
  18. <meta property="og:type" content="website">
  19. <meta property="og:url" content="https://pocketpy.dev/bindings-cpp/">
  20. <meta property="og:title" content="Write C++ Bindings | Portable Python 3.x Interpreter in Modern C">
  21. <meta property="og:description" content="pkpy provides a pybind11 compatible layer which allows users to do convenient bindings. Header files are located in the include/pybind11 directory. Make sure you have added -Iinclude to your compiler flags.">
  22. <meta property="og:site_name" content="pocketpy">
  23. <meta property="og:locale" content="en_US">
  24. <!-- Twitter -->
  25. <meta name="twitter:card" content="summary_large_image">
  26. <meta name="twitter:url" content="https://pocketpy.dev/bindings-cpp/">
  27. <meta name="twitter:title" content="Write C++ Bindings | Portable Python 3.x Interpreter in Modern C">
  28. <meta name="twitter:description" content="pkpy provides a pybind11 compatible layer which allows users to do convenient bindings. Header files are located in the include/pybind11 directory. Make sure you have added -Iinclude to your compiler flags.">
  29. <!-- Alternate Markdown -->
  30. <link rel="alternate" type="text/markdown" href="https://pocketpy.dev/bindings-cpp.md">
  31. <script data-cfasync="false">(function(){var cl=document.documentElement.classList,ls=localStorage.getItem("retype_scheme"),hd=cl.contains("dark"),hl=cl.contains("light"),wm=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches;if(ls==="dark"||(!ls&&wm&&!hd&&!hl)){cl.remove("light");cl.add("dark")}else if(ls==="light"||(!ls&&!wm&&!hd&&!hl)){cl.remove("dark");cl.add("light")}})();</script>
  32. <link id="retype-favicon" rel="icon" href="../static/logo.png" />
  33. <link href="../resources/css/retype.css?v=4.5.3.830753665642" rel="stylesheet">
  34. <script data-cfasync="false" src="../resources/js/config.js?v=4.5.3.830753665642" data-turbo-eval="false" defer></script>
  35. <script data-cfasync="false" src="../resources/js/retype.js?v=4.5.3" data-turbo-eval="false" defer></script>
  36. <script id="lunr-js" data-cfasync="false" src="../resources/js/lunr.js?v=4.5.3.830753665642" data-turbo-eval="false" defer></script>
  37. <script id="prism-js" data-cfasync="false" src="../resources/js/prism.js?v=4.5.3.830753665642" defer></script>
  38. </head>
  39. <body>
  40. <div id="retype-app" class="relative text-base antialiased text-base-text bg-base-bg font-body">
  41. <div class="absolute bottom-0 left-0" style="top: 5rem; right: 50%"></div>
  42. <header id="retype-header" class="sticky top-0 z-30 flex w-full h-16 bg-header-bg border-b border-header-border md:h-20">
  43. <div class="container relative flex items-center justify-between pr-6 grow md:justify-start">
  44. <!-- Mobile menu button skeleton -->
  45. <button v-cloak class="skeleton retype-mobile-menu-button flex items-center justify-center shrink-0 overflow-hidden dark:text-white focus:outline-hidden rounded-full w-10 h-10 ml-3.5 md:hidden"><svg xmlns="http://www.w3.org/2000/svg" class="mb-px shrink-0" width="24" height="24" viewBox="0 0 24 24" role="presentation" style="margin-bottom: 0px;"><g fill="currentColor"><path d="M2 4h20v2H2zM2 11h20v2H2zM2 18h20v2H2z"></path></g></svg></button>
  46. <div v-cloak id="retype-sidebar-left-toggle-button"></div>
  47. <!-- Logo -->
  48. <div class="flex items-center justify-between h-full py-2 md:w-75">
  49. <div class="flex items-center px-2 md:px-6">
  50. <a id="retype-branding-logo" href="https://pocketpy.dev/" class="flex items-center leading-snug text-2xl">
  51. <span class="w-10 mr-2 grow-0 shrink-0 overflow-hidden">
  52. <img class="max-h-10 md:inline-block" src="../static/logo.png" alt="" width="40" height="40">
  53. </span>
  54. <span class="dark:text-white font-bold line-clamp-1 md:line-clamp-2">pocketpy</span>
  55. </a><span id="retype-branding-label" class="inline-flex mt-1 px-2 py-1 ml-4 text-xs font-medium leading-none items-center rounded-md bg-branding-label-bg text-branding-label-text ring-1 ring-branding-label-border ring-inset md:inline-block">v2.1.9</span>
  56. </div>
  57. <span class="hidden h-8 border-r md:inline-block border-base-border"></span>
  58. </div>
  59. <div class="flex justify-between md:grow">
  60. <!-- Top Nav -->
  61. <nav id="retype-header-nav" class="hidden md:flex">
  62. <ul class="flex flex-col mb-4 md:pl-16 md:mb-0 md:flex-row md:items-center">
  63. <li class="mr-6">
  64. <a class="py-2 md:mb-0 inline-flex items-center text-sm whitespace-nowrap transition-colors duration-200 ease-linear md:text-header-text font-header-text hover:text-header-text-hover">
  65. <svg xmlns="http://www.w3.org/2000/svg" class="block shrink-0 mr-1.5" width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true" focusable="false">
  66. <path d="M11.03 2.59a1.501 1.501 0 0 1 1.94 0l7.5 6.363a1.5 1.5 0 0 1 .53 1.144V19.5a1.5 1.5 0 0 1-1.5 1.5h-5.75a.75.75 0 0 1-.75-.75V14h-2v6.25a.75.75 0 0 1-.75.75H4.5A1.5 1.5 0 0 1 3 19.5v-9.403c0-.44.194-.859.53-1.144ZM12 3.734l-7.5 6.363V19.5h5v-6.25a.75.75 0 0 1 .75-.75h3.5a.75.75 0 0 1 .75.75v6.25h5v-9.403Z"/>
  67. </svg>
  68. <span>Home</span>
  69. </a>
  70. </li>
  71. <li class="mr-6">
  72. <a class="py-2 md:mb-0 inline-flex items-center text-sm whitespace-nowrap transition-colors duration-200 ease-linear md:text-header-text font-header-text hover:text-header-text-hover" href="https://pocketpy.dev/static/web/" target="_blank">
  73. <svg xmlns="http://www.w3.org/2000/svg" class="block shrink-0 mr-1.5" width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true" focusable="false">
  74. <path d="M9.5 15.584V8.416a.5.5 0 0 1 .77-.42l5.576 3.583a.5.5 0 0 1 0 .842l-5.576 3.584a.5.5 0 0 1-.77-.42Z"/><path d="M1 12C1 5.925 5.925 1 12 1s11 4.925 11 11-4.925 11-11 11S1 18.075 1 12Zm11-9.5A9.5 9.5 0 0 0 2.5 12a9.5 9.5 0 0 0 9.5 9.5 9.5 9.5 0 0 0 9.5-9.5A9.5 9.5 0 0 0 12 2.5Z"/>
  75. </svg>
  76. <span>Live Demo</span>
  77. </a>
  78. </li>
  79. <li class="mr-6">
  80. <a class="py-2 md:mb-0 inline-flex items-center text-sm whitespace-nowrap transition-colors duration-200 ease-linear md:text-header-text font-header-text hover:text-header-text-hover" href="https://pocketpy.github.io/examples/" target="_blank">
  81. <svg xmlns="http://www.w3.org/2000/svg" class="block shrink-0 mr-1.5" width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true" focusable="false">
  82. <path d="M15.22 4.97a.75.75 0 0 1 1.06 0l6.5 6.5a.75.75 0 0 1 0 1.06l-6.5 6.5a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734L21.19 12l-5.97-5.97a.75.75 0 0 1 0-1.06Zm-6.44 0a.75.75 0 0 1 0 1.06L2.81 12l5.97 5.97a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215l-6.5-6.5a.75.75 0 0 1 0-1.06l6.5-6.5a.75.75 0 0 1 1.06 0Z"/>
  83. </svg>
  84. <span>Live Examples</span>
  85. </a>
  86. </li>
  87. <li class="mr-6">
  88. <a class="py-2 md:mb-0 inline-flex items-center text-sm whitespace-nowrap transition-colors duration-200 ease-linear md:text-header-text font-header-text hover:text-header-text-hover" href="https://github.com/blueloveth/pocketpy" target="_blank">
  89. <svg xmlns="http://www.w3.org/2000/svg" class="block shrink-0 mr-1.5" width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true" focusable="false">
  90. <path d="M10.226 17.284c-2.965-.36-5.054-2.493-5.054-5.256 0-1.123.404-2.336 1.078-3.144-.292-.741-.247-2.314.09-2.965.898-.112 2.111.36 2.83 1.01.853-.269 1.752-.404 2.853-.404 1.1 0 1.999.135 2.807.382.696-.629 1.932-1.1 2.83-.988.315.606.36 2.179.067 2.942.72.854 1.101 2 1.101 3.167 0 2.763-2.089 4.852-5.098 5.234.763.494 1.28 1.572 1.28 2.807v2.336c0 .674.561 1.056 1.235.786 4.066-1.55 7.255-5.615 7.255-10.646C23.5 6.188 18.334 1 11.978 1 5.62 1 .5 6.188.5 12.545c0 4.986 3.167 9.12 7.435 10.669.606.225 1.19-.18 1.19-.786V20.63a2.9 2.9 0 0 1-1.078.224c-1.483 0-2.359-.808-2.987-2.313-.247-.607-.517-.966-1.034-1.033-.27-.023-.359-.135-.359-.27 0-.27.45-.471.898-.471.652 0 1.213.404 1.797 1.235.45.651.921.943 1.483.943.561 0 .92-.202 1.437-.719.382-.381.674-.718.944-.943"/>
  91. </svg>
  92. <span>Github</span>
  93. </a>
  94. </li>
  95. <li class="mr-6">
  96. <a class="py-2 md:mb-0 inline-flex items-center text-sm whitespace-nowrap transition-colors duration-200 ease-linear md:text-header-text font-header-text hover:text-header-text-hover" href="https://discord.gg/WWaq72GzXv" target="_blank">
  97. <svg xmlns="http://www.w3.org/2000/svg" class="block shrink-0 mr-1.5" width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true" focusable="false">
  98. <path d="M1.75 1h12.5c.966 0 1.75.784 1.75 1.75v9.5A1.75 1.75 0 0 1 14.25 14H8.061l-2.574 2.573A1.458 1.458 0 0 1 3 15.543V14H1.75A1.75 1.75 0 0 1 0 12.25v-9.5C0 1.784.784 1 1.75 1ZM1.5 2.75v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25Z"/><path d="M22.5 8.75a.25.25 0 0 0-.25-.25h-3.5a.75.75 0 0 1 0-1.5h3.5c.966 0 1.75.784 1.75 1.75v9.5A1.75 1.75 0 0 1 22.25 20H21v1.543a1.457 1.457 0 0 1-2.487 1.03L15.939 20H10.75A1.75 1.75 0 0 1 9 18.25v-1.465a.75.75 0 0 1 1.5 0v1.465c0 .138.112.25.25.25h5.5a.75.75 0 0 1 .53.22l2.72 2.72v-2.19a.75.75 0 0 1 .75-.75h2a.25.25 0 0 0 .25-.25v-9.5Z"/>
  99. </svg>
  100. <span>Discord</span>
  101. </a>
  102. </li>
  103. </ul>
  104. </nav>
  105. <div v-cloak class="flex justify-end grow">
  106. <div id="retype-mobile-search-button"></div>
  107. <doc-search-desktop></doc-search-desktop>
  108. <doc-theme-switch class="lg:ml-2"></doc-theme-switch>
  109. <doc-history></doc-history>
  110. </div>
  111. </div>
  112. </div>
  113. </header>
  114. <div id="retype-container" class="container relative flex bg-white">
  115. <!-- Sidebar Skeleton -->
  116. <div v-cloak class="fixed flex flex-col shrink-0 duration-300 ease-in-out bg-sidebar-left-bg border-sidebar-left-border sidebar top-20 w-75 border-r h-screen md:sticky transition-transform skeleton">
  117. <div class="flex items-center h-16 px-6">
  118. <input id="retype-filter-input-mock" class="w-full h-10 pl-8 px-3 py-2 transition-colors duration-200 ease-linear bg-filter-bg border border-filter-border rounded-lg shadow-none md:text-sm hover:border-filter-border-hover focus:outline-hidden focus:border-filter-border-focus placeholder-filter-placeholder" type="text">
  119. </div>
  120. <div class="pl-6 mt-1 mb-4">
  121. <div class="w-32 h-3 mb-4 bg-skeleton-bg rounded-full loading"></div>
  122. <div class="w-48 h-3 mb-4 bg-skeleton-bg rounded-full loading"></div>
  123. <div class="w-40 h-3 mb-4 bg-skeleton-bg rounded-full loading"></div>
  124. <div class="w-32 h-3 mb-4 bg-skeleton-bg rounded-full loading"></div>
  125. <div class="w-48 h-3 mb-4 bg-skeleton-bg rounded-full loading"></div>
  126. <div class="w-40 h-3 mb-4 bg-skeleton-bg rounded-full loading"></div>
  127. </div>
  128. <div class="shrink-0 mt-auto bg-transparent dark:border-base-border">
  129. <a class="flex items-center justify-center flex-nowrap h-16 text-gray-350 dark:text-dark-400 hover:text-gray-600 dark:hover:text-dark-300 transition-colors duration-150 ease-in docs-powered-by" target="_blank" href="https://retype.com/" rel="noopener">
  130. <span class="text-xs whitespace-nowrap">Powered by</span>
  131. <svg xmlns="http://www.w3.org/2000/svg" class="ml-2" fill="currentColor" width="96" height="20" overflow="visible"><path d="M0 0v20h13.59V0H0zm11.15 17.54H2.44V2.46h8.71v15.08zM15.8 20h2.44V4.67L15.8 2.22zM20.45 6.89V20h2.44V9.34z"/><g><path d="M40.16 8.44c0 1.49-.59 2.45-1.75 2.88l2.34 3.32h-2.53l-2.04-2.96h-1.43v2.96h-2.06V5.36h3.5c1.43 0 2.46.24 3.07.73s.9 1.27.9 2.35zm-2.48 1.1c.26-.23.38-.59.38-1.09 0-.5-.13-.84-.4-1.03s-.73-.28-1.39-.28h-1.54v2.75h1.5c.72 0 1.2-.12 1.45-.35zM51.56 5.36V7.2h-4.59v1.91h4.13v1.76h-4.13v1.92h4.74v1.83h-6.79V5.36h6.64zM60.09 7.15v7.48h-2.06V7.15h-2.61V5.36h7.28v1.79h-2.61zM70.81 14.64h-2.06v-3.66l-3.19-5.61h2.23l1.99 3.45 1.99-3.45H74l-3.19 5.61v3.66zM83.99 6.19c.65.55.97 1.4.97 2.55s-.33 1.98-1 2.51-1.68.8-3.04.8h-1.23v2.59h-2.06V5.36h3.26c1.42 0 2.45.28 3.1.83zm-1.51 3.65c.25-.28.37-.69.37-1.22s-.16-.92-.48-1.14c-.32-.23-.82-.34-1.5-.34H79.7v3.12h1.38c.68 0 1.15-.14 1.4-.42zM95.85 5.36V7.2h-4.59v1.91h4.13v1.76h-4.13v1.92H96v1.83h-6.79V5.36h6.64z"/></g></svg>
  132. </a>
  133. </div>
  134. </div>
  135. <!-- Sidebar component -->
  136. <doc-sidebar v-cloak>
  137. <template #sidebar-footer>
  138. <div class="shrink-0 mt-auto border-t md:bg-transparent md:border-none dark:border-base-border">
  139. <div class="py-3 px-6 md:hidden border-b dark:border-base-border">
  140. <nav>
  141. <ul class="flex flex-wrap justify-center items-center">
  142. <li class="mr-6">
  143. <a class="block py-1 inline-flex items-center text-sm whitespace-nowrap transition-colors duration-200 ease-linear md:text-header-text font-header-text hover:text-header-text-hover">
  144. <svg xmlns="http://www.w3.org/2000/svg" class="block shrink-0 mr-1.5" width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true" focusable="false">
  145. <path d="M11.03 2.59a1.501 1.501 0 0 1 1.94 0l7.5 6.363a1.5 1.5 0 0 1 .53 1.144V19.5a1.5 1.5 0 0 1-1.5 1.5h-5.75a.75.75 0 0 1-.75-.75V14h-2v6.25a.75.75 0 0 1-.75.75H4.5A1.5 1.5 0 0 1 3 19.5v-9.403c0-.44.194-.859.53-1.144ZM12 3.734l-7.5 6.363V19.5h5v-6.25a.75.75 0 0 1 .75-.75h3.5a.75.75 0 0 1 .75.75v6.25h5v-9.403Z"/>
  146. </svg>
  147. <span>Home</span>
  148. </a>
  149. </li>
  150. <li class="mr-6">
  151. <a class="block py-1 inline-flex items-center text-sm whitespace-nowrap transition-colors duration-200 ease-linear md:text-header-text font-header-text hover:text-header-text-hover" href="https://pocketpy.dev/static/web/" target="_blank">
  152. <svg xmlns="http://www.w3.org/2000/svg" class="block shrink-0 mr-1.5" width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true" focusable="false">
  153. <path d="M9.5 15.584V8.416a.5.5 0 0 1 .77-.42l5.576 3.583a.5.5 0 0 1 0 .842l-5.576 3.584a.5.5 0 0 1-.77-.42Z"/><path d="M1 12C1 5.925 5.925 1 12 1s11 4.925 11 11-4.925 11-11 11S1 18.075 1 12Zm11-9.5A9.5 9.5 0 0 0 2.5 12a9.5 9.5 0 0 0 9.5 9.5 9.5 9.5 0 0 0 9.5-9.5A9.5 9.5 0 0 0 12 2.5Z"/>
  154. </svg>
  155. <span>Live Demo</span>
  156. </a>
  157. </li>
  158. <li class="mr-6">
  159. <a class="block py-1 inline-flex items-center text-sm whitespace-nowrap transition-colors duration-200 ease-linear md:text-header-text font-header-text hover:text-header-text-hover" href="https://pocketpy.github.io/examples/" target="_blank">
  160. <svg xmlns="http://www.w3.org/2000/svg" class="block shrink-0 mr-1.5" width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true" focusable="false">
  161. <path d="M15.22 4.97a.75.75 0 0 1 1.06 0l6.5 6.5a.75.75 0 0 1 0 1.06l-6.5 6.5a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734L21.19 12l-5.97-5.97a.75.75 0 0 1 0-1.06Zm-6.44 0a.75.75 0 0 1 0 1.06L2.81 12l5.97 5.97a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215l-6.5-6.5a.75.75 0 0 1 0-1.06l6.5-6.5a.75.75 0 0 1 1.06 0Z"/>
  162. </svg>
  163. <span>Live Examples</span>
  164. </a>
  165. </li>
  166. <li class="mr-6">
  167. <a class="block py-1 inline-flex items-center text-sm whitespace-nowrap transition-colors duration-200 ease-linear md:text-header-text font-header-text hover:text-header-text-hover" href="https://github.com/blueloveth/pocketpy" target="_blank">
  168. <svg xmlns="http://www.w3.org/2000/svg" class="block shrink-0 mr-1.5" width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true" focusable="false">
  169. <path d="M10.226 17.284c-2.965-.36-5.054-2.493-5.054-5.256 0-1.123.404-2.336 1.078-3.144-.292-.741-.247-2.314.09-2.965.898-.112 2.111.36 2.83 1.01.853-.269 1.752-.404 2.853-.404 1.1 0 1.999.135 2.807.382.696-.629 1.932-1.1 2.83-.988.315.606.36 2.179.067 2.942.72.854 1.101 2 1.101 3.167 0 2.763-2.089 4.852-5.098 5.234.763.494 1.28 1.572 1.28 2.807v2.336c0 .674.561 1.056 1.235.786 4.066-1.55 7.255-5.615 7.255-10.646C23.5 6.188 18.334 1 11.978 1 5.62 1 .5 6.188.5 12.545c0 4.986 3.167 9.12 7.435 10.669.606.225 1.19-.18 1.19-.786V20.63a2.9 2.9 0 0 1-1.078.224c-1.483 0-2.359-.808-2.987-2.313-.247-.607-.517-.966-1.034-1.033-.27-.023-.359-.135-.359-.27 0-.27.45-.471.898-.471.652 0 1.213.404 1.797 1.235.45.651.921.943 1.483.943.561 0 .92-.202 1.437-.719.382-.381.674-.718.944-.943"/>
  170. </svg>
  171. <span>Github</span>
  172. </a>
  173. </li>
  174. <li class="mr-6">
  175. <a class="block py-1 inline-flex items-center text-sm whitespace-nowrap transition-colors duration-200 ease-linear md:text-header-text font-header-text hover:text-header-text-hover" href="https://discord.gg/WWaq72GzXv" target="_blank">
  176. <svg xmlns="http://www.w3.org/2000/svg" class="block shrink-0 mr-1.5" width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true" focusable="false">
  177. <path d="M1.75 1h12.5c.966 0 1.75.784 1.75 1.75v9.5A1.75 1.75 0 0 1 14.25 14H8.061l-2.574 2.573A1.458 1.458 0 0 1 3 15.543V14H1.75A1.75 1.75 0 0 1 0 12.25v-9.5C0 1.784.784 1 1.75 1ZM1.5 2.75v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25Z"/><path d="M22.5 8.75a.25.25 0 0 0-.25-.25h-3.5a.75.75 0 0 1 0-1.5h3.5c.966 0 1.75.784 1.75 1.75v9.5A1.75 1.75 0 0 1 22.25 20H21v1.543a1.457 1.457 0 0 1-2.487 1.03L15.939 20H10.75A1.75 1.75 0 0 1 9 18.25v-1.465a.75.75 0 0 1 1.5 0v1.465c0 .138.112.25.25.25h5.5a.75.75 0 0 1 .53.22l2.72 2.72v-2.19a.75.75 0 0 1 .75-.75h2a.25.25 0 0 0 .25-.25v-9.5Z"/>
  178. </svg>
  179. <span>Discord</span>
  180. </a>
  181. </li>
  182. </ul>
  183. </nav>
  184. </div>
  185. <a class="flex items-center justify-center flex-nowrap h-16 text-gray-350 dark:text-dark-400 hover:text-gray-600 dark:hover:text-dark-300 transition-colors duration-150 ease-in docs-powered-by" target="_blank" href="https://retype.com/" rel="noopener">
  186. <span class="text-xs whitespace-nowrap">Powered by</span>
  187. <svg xmlns="http://www.w3.org/2000/svg" class="ml-2" fill="currentColor" width="96" height="20" overflow="visible"><path d="M0 0v20h13.59V0H0zm11.15 17.54H2.44V2.46h8.71v15.08zM15.8 20h2.44V4.67L15.8 2.22zM20.45 6.89V20h2.44V9.34z"/><g><path d="M40.16 8.44c0 1.49-.59 2.45-1.75 2.88l2.34 3.32h-2.53l-2.04-2.96h-1.43v2.96h-2.06V5.36h3.5c1.43 0 2.46.24 3.07.73s.9 1.27.9 2.35zm-2.48 1.1c.26-.23.38-.59.38-1.09 0-.5-.13-.84-.4-1.03s-.73-.28-1.39-.28h-1.54v2.75h1.5c.72 0 1.2-.12 1.45-.35zM51.56 5.36V7.2h-4.59v1.91h4.13v1.76h-4.13v1.92h4.74v1.83h-6.79V5.36h6.64zM60.09 7.15v7.48h-2.06V7.15h-2.61V5.36h7.28v1.79h-2.61zM70.81 14.64h-2.06v-3.66l-3.19-5.61h2.23l1.99 3.45 1.99-3.45H74l-3.19 5.61v3.66zM83.99 6.19c.65.55.97 1.4.97 2.55s-.33 1.98-1 2.51-1.68.8-3.04.8h-1.23v2.59h-2.06V5.36h3.26c1.42 0 2.45.28 3.1.83zm-1.51 3.65c.25-.28.37-.69.37-1.22s-.16-.92-.48-1.14c-.32-.23-.82-.34-1.5-.34H79.7v3.12h1.38c.68 0 1.15-.14 1.4-.42zM95.85 5.36V7.2h-4.59v1.91h4.13v1.76h-4.13v1.92H96v1.83h-6.79V5.36h6.64z"/></g></svg>
  188. </a>
  189. </div>
  190. </template>
  191. </doc-sidebar>
  192. <div class="grow min-w-0 bg-body-bg">
  193. <!-- Render "toolbar" template here on api pages --><!-- Render page content -->
  194. <div class="flex">
  195. <div id="retype-main" class="min-w-0 p-4 grow md:px-16">
  196. <main class="relative pb-12 lg:pt-2">
  197. <div class="relative retype-markdown" id="retype-content">
  198. <!-- Rendered if sidebar right is enabled -->
  199. <div id="retype-sidebar-right-toggle"></div>
  200. <doc-page-actions></doc-page-actions>
  201. <!-- Page content -->
  202. <h1 id="write-c-bindings">Write C++ Bindings</h1>
  203. <h2 id="quick-start">Quick Start</h2>
  204. <p>pkpy provides a <a href="https://pybind11.readthedocs.io/en/stable/">pybind11</a> compatible layer which allows users to do convenient bindings.
  205. Header files are located in the <code translate="no" v-pre>include/pybind11</code> directory. Make sure you have added <code translate="no" v-pre>-Iinclude</code> to your compiler flags.</p>
  206. <p>To begin with, use <code translate="no" v-pre>py::scoped_interpreter guard{}</code> to start the interpreter before using any Python objects.
  207. Or explicitly call <code translate="no" v-pre>py::interpreter::initialize()</code> and <code translate="no" v-pre>py::interpreter::finalize()</code>.</p>
  208. <h3 id="module">module</h3>
  209. <div id="module-code-1" class="codeblock-wrapper"><doc-codeblock>
  210. <pre translate="no" class="language-cpp"><code v-pre class="language-cpp">#include &lt;pybind11/pybind11.h&gt;
  211. namespace py = pybind11;
  212. PYBIND11_EMBEDDED_MODULE(example, m) {
  213. m.def(&quot;add&quot;, [](int a, int b) {
  214. return a + b;
  215. });
  216. auto math = m.def_submodule(&quot;math&quot;);
  217. }</code></pre>
  218. </doc-codeblock></div>
  219. <h3 id="function">function</h3>
  220. <div id="function-code-1" class="codeblock-wrapper"><doc-codeblock>
  221. <pre translate="no" class="language-cpp"><code v-pre class="language-cpp">int add(int a, int b) { return a + b; }
  222. int add(int a, int b, int c) { return a + b + c; }
  223. void register_function(py::module_&amp; m)
  224. {
  225. m.def(&quot;add&quot;, py::overload_cast&lt;int, int&gt;(&amp;add));
  226. // support function overload
  227. m.def(&quot;add&quot;, py::overload_cast&lt;int, int, int&gt;(&amp;add));
  228. // bind with default arguments
  229. m.def(&quot;sub&quot;, [](int a, int b) {
  230. return a - b;
  231. }, py::arg(&quot;a&quot;) = 1, py::arg(&quot;b&quot;) = 2);
  232. // bind *args
  233. m.def(&quot;add&quot;, [](py::args args) {
  234. int sum = 0;
  235. for (auto&amp; arg : args) {
  236. sum += arg.cast&lt;int&gt;();
  237. }
  238. return sum;
  239. });
  240. // bind **kwargs
  241. m.def(&quot;add&quot;, [](py::kwargs kwargs) {
  242. int sum = 0;
  243. for (auto item : kwargs) {
  244. sum += item.second.cast&lt;int&gt;();
  245. }
  246. return sum;
  247. });
  248. }</code></pre>
  249. </doc-codeblock></div>
  250. <h3 id="class">class</h3>
  251. <div id="class-code-1" class="codeblock-wrapper"><doc-codeblock>
  252. <pre translate="no" class="language-cpp"><code v-pre class="language-cpp">struct Point
  253. {
  254. const int x;
  255. int y;
  256. public:
  257. Point() : x(0), y(0) {}
  258. Point(int x, int y) : x(x), y(y) {}
  259. Point(const Point&amp; p) : x(p.x), y(p.y) {}
  260. std::string stringfy() const {
  261. return &quot;(&quot; + std::to_string(x) + &quot;, &quot; + std::to_string(y) + &quot;)&quot;;
  262. }
  263. };
  264. struct Point3D : Point
  265. {
  266. private:
  267. int z;
  268. public:
  269. Point3D(int x, int y, int z) : Point(x, y), z(z) {}
  270. int get_z() const { return z; }
  271. void set_z(int z) { this-&gt;z = z; }
  272. };
  273. void bind_class(py::module_&amp; m)
  274. {
  275. py::class_&lt;Point&gt;(m, &quot;Point&quot;)
  276. .def(py::init&lt;&gt;())
  277. .def(py::init&lt;int, int&gt;())
  278. .def(py::init&lt;const Point&amp;&gt;())
  279. .def_readonly(&quot;x&quot;, &amp;Point::x)
  280. .def_readwrite(&quot;y&quot;, &amp;Point::y)
  281. .def(&quot;__str__&quot;, &amp;Point::stringfy);
  282. // only support single inheritance
  283. py::class_&lt;Point3D, Point&gt;(m, &quot;Point3D&quot;, py::dynamic_attr())
  284. .def(py::init&lt;int, int, int&gt;())
  285. .def_property(&quot;z&quot;, &amp;Point3D::get_z, &amp;Point3D::set_z);
  286. // dynamic_attr will enable the dict of bound class
  287. }</code></pre>
  288. </doc-codeblock></div>
  289. <h3 id="operators">operators</h3>
  290. <div id="operators-code-1" class="codeblock-wrapper"><doc-codeblock>
  291. <pre translate="no" class="language-cpp"><code v-pre class="language-cpp">#include &lt;pybind11/operators.h&gt;
  292. namespace py = pybind11;
  293. struct Int {
  294. int value;
  295. Int(int value) : value(value) {}
  296. Int operator+(const Int&amp; other) const {
  297. return Int(value + other.value);
  298. }
  299. Int operator-(const Int&amp; other) const {
  300. return Int(value - other.value);
  301. }
  302. bool operator==(const Int&amp; other) const {
  303. return value == other.value;
  304. }
  305. bool operator!=(const Int&amp; other) const {
  306. return value != other.value;
  307. }
  308. };
  309. void bind_operators(py::module_&amp; m)
  310. {
  311. py::class_&lt;Int&gt;(m, &quot;Int&quot;)
  312. .def(py::init&lt;int&gt;())
  313. .def(py::self + py::self)
  314. .def(py::self - py::self)
  315. .def(py::self == py::self)
  316. .def(py::self != py::self);
  317. // other operators are similar
  318. }</code></pre>
  319. </doc-codeblock></div>
  320. <h3 id="pyobject">py::object</h3>
  321. <p><code translate="no" v-pre>py::object</code> is just simple wrapper around <code translate="no" v-pre>PyVar</code>. It supports some convenient methods to interact with Python objects.</p>
  322. <p>here are some common methods:</p>
  323. <div id="pyobject-code-1" class="codeblock-wrapper"><doc-codeblock>
  324. <pre translate="no" class="language-cpp"><code v-pre class="language-cpp">obj.attr(&quot;x&quot;); // access attribute
  325. obj[1]; // access item
  326. obj.is_none(); // same as obj is None in Python
  327. obj.is(obj2); // same as obj is obj2 in Python
  328. // operators
  329. obj + obj2; // same as obj + obj2 in Python
  330. // ...
  331. obj == obj2; // same as obj == obj2 in Python
  332. // ...
  333. obj(...); // same as obj.__call__(...)
  334. py::cast(obj); // cast to Python object
  335. obj.cast&lt;T&gt;; // cast to C++ type
  336. py::type::of(obj); // get type of obj
  337. py::type::of&lt;T&gt;(); // get type of T, if T is registered</code></pre>
  338. </doc-codeblock></div>
  339. <p>you can also create some builtin objects with their according wrappers:</p>
  340. <div id="pyobject-code-2" class="codeblock-wrapper"><doc-codeblock>
  341. <pre translate="no" class="language-cpp"><code v-pre class="language-cpp">py::bool_ b = {true};
  342. py::int_ i = {1};
  343. py::float_ f = {1.0};
  344. py::str s = {&quot;hello&quot;};
  345. py::list l = {1, 2, 3};
  346. py::tuple t = {1, 2, 3};
  347. // ...</code></pre>
  348. </doc-codeblock></div>
  349. <h2 id="more-examples">More Examples</h2>
  350. <p>More examples please see the test <a href="https://github.com/pocketpy/gsoc-2024-dev/tree/main/pybind11/tests">folder</a> in the GSoC repository. All tested features are supported.</p>
  351. <h2 id="limits-and-comparison">Limits and Comparison</h2>
  352. <p>This is a feature list of pybind11 for pocketpy. It lists all completed and pending features. It also lists the features that cannot be implemented in the current version of pocketpy.</p>
  353. <h3 id="function-1"><a href="https://pybind11.readthedocs.io/en/stable/advanced/functions.html">Function</a></h3>
  354. <ul class="contains-task-list">
  355. <li class="task-list-item"><input disabled="disabled" type="checkbox" checked="checked" /> Function overloading</li>
  356. <li class="task-list-item"><input disabled="disabled" type="checkbox" checked="checked" /> Return value policy</li>
  357. <li class="task-list-item"><input disabled="disabled" type="checkbox" checked="checked" /> is_prepend</li>
  358. <li class="task-list-item"><input disabled="disabled" type="checkbox" checked="checked" /> <code translate="no" v-pre>*args</code> and <code translate="no" v-pre>**kwargs</code></li>
  359. <li class="task-list-item"><input disabled="disabled" type="checkbox" /> Keep-alive</li>
  360. <li class="task-list-item"><input disabled="disabled" type="checkbox" /> Call Guard</li>
  361. <li class="task-list-item"><input disabled="disabled" type="checkbox" checked="checked" /> Default arguments</li>
  362. <li class="task-list-item"><input disabled="disabled" type="checkbox" /> Keyword-Only arguments</li>
  363. <li class="task-list-item"><input disabled="disabled" type="checkbox" /> Positional-Only arguments</li>
  364. <li class="task-list-item"><input disabled="disabled" type="checkbox" /> Allow/Prohibiting None arguments</li>
  365. </ul>
  366. <h3 id="class-1"><a href="https://pybind11.readthedocs.io/en/stable/classes.html">Class</a></h3>
  367. <ul class="contains-task-list">
  368. <li class="task-list-item"><input disabled="disabled" type="checkbox" checked="checked" /> Creating bindings for a custom type</li>
  369. <li class="task-list-item"><input disabled="disabled" type="checkbox" checked="checked" /> Binding lambda functions</li>
  370. <li class="task-list-item"><input disabled="disabled" type="checkbox" checked="checked" /> Dynamic attributes</li>
  371. <li class="task-list-item"><input disabled="disabled" type="checkbox" checked="checked" /> Inheritance and automatic downcasting</li>
  372. <li class="task-list-item"><input disabled="disabled" type="checkbox" checked="checked" /> Enumerations and internal types</li>
  373. <li class="task-list-item"><input disabled="disabled" type="checkbox" /> Instance and static fields</li>
  374. </ul>
  375. <blockquote>
  376. <p>Binding static fields may never be implemented in pocketpy because it requires a metaclass, which is a heavy and infrequently used feature.</p>
  377. </blockquote>
  378. <h3 id="exceptions"><a href="https://pybind11.readthedocs.io/en/stable/advanced/exceptions.html">Exceptions</a></h3>
  379. <p>Need further discussion.</p>
  380. <h3 id="smart-pointers"><a href="https://pybind11.readthedocs.io/en/stable/advanced/smart_ptrs.html">Smart pointers</a></h3>
  381. <ul class="contains-task-list">
  382. <li class="task-list-item"><input disabled="disabled" type="checkbox" /> std::shared_ptr</li>
  383. <li class="task-list-item"><input disabled="disabled" type="checkbox" /> std::unique_ptr</li>
  384. <li class="task-list-item"><input disabled="disabled" type="checkbox" /> Custom smart pointers</li>
  385. </ul>
  386. <h3 id="type-conversions"><a href="https://pybind11.readthedocs.io/en/stable/advanced/cast/index.html">Type conversions</a></h3>
  387. <ul class="contains-task-list">
  388. <li class="task-list-item"><input disabled="disabled" type="checkbox" checked="checked" /> Python built-in types</li>
  389. <li class="task-list-item"><input disabled="disabled" type="checkbox" checked="checked" /> STL Containers</li>
  390. <li class="task-list-item"><input disabled="disabled" type="checkbox" /> Functional</li>
  391. <li class="task-list-item"><input disabled="disabled" type="checkbox" /> Chrono</li>
  392. </ul>
  393. <h3 id="python-c-interface"><a href="https://pybind11.readthedocs.io/en/stable/advanced/pycpp/object.html">Python C++ interface</a></h3>
  394. <p>Need further discussion.</p>
  395. <ul class="contains-task-list">
  396. <li class="task-list-item"><input disabled="disabled" type="checkbox" checked="checked" /> <code translate="no" v-pre>object</code></li>
  397. <li class="task-list-item"><input disabled="disabled" type="checkbox" checked="checked" /> <code translate="no" v-pre>none</code></li>
  398. <li class="task-list-item"><input disabled="disabled" type="checkbox" checked="checked" /> <code translate="no" v-pre>type</code></li>
  399. <li class="task-list-item"><input disabled="disabled" type="checkbox" checked="checked" /> <code translate="no" v-pre>bool_</code></li>
  400. <li class="task-list-item"><input disabled="disabled" type="checkbox" checked="checked" /> <code translate="no" v-pre>int_</code></li>
  401. <li class="task-list-item"><input disabled="disabled" type="checkbox" checked="checked" /> <code translate="no" v-pre>float_</code></li>
  402. <li class="task-list-item"><input disabled="disabled" type="checkbox" checked="checked" /> <code translate="no" v-pre>str</code></li>
  403. <li class="task-list-item"><input disabled="disabled" type="checkbox" /> <code translate="no" v-pre>bytes</code></li>
  404. <li class="task-list-item"><input disabled="disabled" type="checkbox" /> <code translate="no" v-pre>bytearray</code></li>
  405. <li class="task-list-item"><input disabled="disabled" type="checkbox" checked="checked" /> <code translate="no" v-pre>tuple</code></li>
  406. <li class="task-list-item"><input disabled="disabled" type="checkbox" checked="checked" /> <code translate="no" v-pre>list</code></li>
  407. <li class="task-list-item"><input disabled="disabled" type="checkbox" /> <code translate="no" v-pre>set</code></li>
  408. <li class="task-list-item"><input disabled="disabled" type="checkbox" checked="checked" /> <code translate="no" v-pre>dict</code></li>
  409. <li class="task-list-item"><input disabled="disabled" type="checkbox" /> <code translate="no" v-pre>slice</code></li>
  410. <li class="task-list-item"><input disabled="disabled" type="checkbox" checked="checked" /> <code translate="no" v-pre>iterable</code></li>
  411. <li class="task-list-item"><input disabled="disabled" type="checkbox" checked="checked" /> <code translate="no" v-pre>iterator</code></li>
  412. <li class="task-list-item"><input disabled="disabled" type="checkbox" /> <code translate="no" v-pre>function</code></li>
  413. <li class="task-list-item"><input disabled="disabled" type="checkbox" /> <code translate="no" v-pre>buffer</code></li>
  414. <li class="task-list-item"><input disabled="disabled" type="checkbox" /> <code translate="no" v-pre>memoryview</code></li>
  415. <li class="task-list-item"><input disabled="disabled" type="checkbox" checked="checked" /> <code translate="no" v-pre>capsule</code></li>
  416. </ul>
  417. <h3 id="miscellaneous"><a href="https://pybind11.readthedocs.io/en/stable/advanced/misc.html">Miscellaneous</a></h3>
  418. <ul class="contains-task-list">
  419. <li class="task-list-item"><input disabled="disabled" type="checkbox" /> Global Interpreter Lock (GIL)</li>
  420. <li class="task-list-item"><input disabled="disabled" type="checkbox" /> Binding sequence data types, iterators, the slicing protocol, etc.</li>
  421. <li class="task-list-item"><input disabled="disabled" type="checkbox" checked="checked" /> Convenient operators binding</li>
  422. </ul>
  423. <h3 id="differences-between-cpython-and-pocketpy">Differences between CPython and pocketpy</h3>
  424. <ul>
  425. <li>
  426. <p>only <code translate="no" v-pre>add</code>, <code translate="no" v-pre>sub</code> and <code translate="no" v-pre>mul</code> have corresponding right versions in pocketpy. So if you bind <code translate="no" v-pre>int() &gt;&gt; py::self</code>, it will has no effect in pocketpy.</p>
  427. </li>
  428. <li>
  429. <p><code translate="no" v-pre>__new__</code> and <code translate="no" v-pre>__del__</code> are not supported in pocketpy.</p>
  430. </li>
  431. <li>
  432. <p>in-place operators, such as <code translate="no" v-pre>+=</code>, <code translate="no" v-pre>-=</code>, <code translate="no" v-pre>*=</code>, etc., are not supported in pocketpy.</p>
  433. </li>
  434. <li>
  435. <p>the return value of <code translate="no" v-pre>globals</code> is immutable in pocketpy.</p>
  436. </li>
  437. </ul>
  438. <!-- Required only on API pages -->
  439. <doc-toolbar-member-filter-no-results></doc-toolbar-member-filter-no-results>
  440. </div>
  441. <footer id="retype-content-footer" class="clear-both">
  442. <nav id="retype-nextprev" class="print:hidden flex mt-14">
  443. <div class="w-1/2">
  444. <a class="px-5 py-4 h-full flex items-center break-normal font-medium text-body-link border border-base-border hover:border-base-border-hover rounded-l-lg transition-colors duration-150 relative hover:z-5" href="../bindings/">
  445. <svg xmlns="http://www.w3.org/2000/svg" class="mr-3" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" overflow="visible"><path d="M19 11H7.41l5.29-5.29a.996.996 0 10-1.41-1.41l-7 7a1 1 0 000 1.42l7 7a1.024 1.024 0 001.42-.01.996.996 0 000-1.41L7.41 13H19c.55 0 1-.45 1-1s-.45-1-1-1z" /><path fill="none" d="M0 0h24v24H0z" /></svg>
  446. <span>
  447. <span class="block text-xs font-normal text-base-text-muted">Previous</span>
  448. <span class="block mt-1">Write C Bindings</span>
  449. </span>
  450. </a>
  451. </div>
  452. <div class="w-1/2">
  453. <a class="px-5 py-4 -mx-px h-full flex items-center justify-end break-normal font-medium text-body-link border border-base-border hover:border-base-border-hover rounded-r-lg transition-colors duration-150 relative hover:z-5" href="../features/basic/">
  454. <span>
  455. <span class="block text-xs font-normal text-right text-base-text-muted">Next</span>
  456. <span class="block mt-1">Basic Features</span>
  457. </span>
  458. <svg xmlns="http://www.w3.org/2000/svg" class="ml-3" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" overflow="visible"><path d="M19.92 12.38a1 1 0 00-.22-1.09l-7-7a.996.996 0 10-1.41 1.41l5.3 5.3H5c-.55 0-1 .45-1 1s.45 1 1 1h11.59l-5.29 5.29a.996.996 0 000 1.41c.19.2.44.3.7.3s.51-.1.71-.29l7-7c.09-.09.16-.21.21-.33z" /><path fill="none" d="M0 0h24v24H0z" /></svg>
  459. </a>
  460. </div>
  461. </nav>
  462. </footer>
  463. </main>
  464. <div id="retype-page-footer" class="print:border-none border-t border-base-border pt-6 mb-8">
  465. <footer class="flex flex-wrap items-center justify-between print:justify-center">
  466. <div id="retype-footer-links" class="print:hidden">
  467. <ul class="flex flex-wrap items-center text-sm">
  468. </ul>
  469. </div>
  470. <div id="retype-copyright" class="print:justify-center py-2 text-footer-text font-footer-link text-sm leading-relaxed"><p>© Copyright 2026 - <a href="https://github.com/blueloveTH">blueloveTH</a> - All rights reserved.</p></div>
  471. </footer>
  472. </div>
  473. </div>
  474. <!-- Rendered if sidebar right is enabled -->
  475. <!-- Sidebar right skeleton-->
  476. <div v-cloak class="fixed top-0 bottom-0 right-0 translate-x-full bg-sidebar-right-bg border-sidebar-right-border lg:sticky lg:border-l lg:shrink-0 lg:pt-6 lg:translate-x-0 sm:w-1/2 lg:w-64 lg:z-0 md:w-104 sidebar-right skeleton">
  477. <div class="pl-5">
  478. <div class="w-32 h-3 mb-4 bg-skeleton-bg rounded-full loading"></div>
  479. <div class="w-48 h-3 mb-4 bg-skeleton-bg rounded-full loading"></div>
  480. <div class="w-40 h-3 mb-4 bg-skeleton-bg rounded-full loading"></div>
  481. </div>
  482. </div>
  483. <!-- User should be able to hide sidebar right -->
  484. <doc-sidebar-right v-cloak></doc-sidebar-right>
  485. </div>
  486. </div>
  487. </div>
  488. <doc-search-mobile></doc-search-mobile>
  489. <doc-back-to-top></doc-back-to-top>
  490. </div>
  491. <div id="retype-overlay-target"></div>
  492. <script data-cfasync="false">window.__DOCS__ = { "title": "Write C++ Bindings", level: 1, icon: "file", hasPrism: true, hasInstagram: false, hasMermaid: false, hasMath: false, tocDepth: 23, "md": "/bindings-cpp.md" }</script>
  493. </body>
  494. </html>