{"id":620,"date":"2022-01-28T23:50:45","date_gmt":"2022-01-28T23:50:45","guid":{"rendered":"https:\/\/synthnotes.ucsd.edu\/wp4\/?p=620"},"modified":"2022-01-28T23:50:45","modified_gmt":"2022-01-28T23:50:45","slug":"pd-externals-in-xcode-v11","status":"publish","type":"post","link":"https:\/\/synthnotes.ucsd.edu\/wp4\/index.php\/2022\/01\/28\/pd-externals-in-xcode-v11\/","title":{"rendered":"PD externals in Xcode (v11)"},"content":{"rendered":"\n<ol class=\"wp-block-list\"><li>Create a new project (New>Project&#8230; from file menu)<\/li><li>Select <strong>macOS<\/strong> in the template dialog, and <strong>Library<\/strong> under Framework &amp; Library<\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"733\" src=\"https:\/\/synthnotes.ucsd.edu\/wp4\/wp-content\/uploads\/2022\/01\/Screen-Shot-2022-01-28-at-3.21.31-PM-1024x733.png\" alt=\"\" class=\"wp-image-621\" srcset=\"https:\/\/synthnotes.ucsd.edu\/wp4\/wp-content\/uploads\/2022\/01\/Screen-Shot-2022-01-28-at-3.21.31-PM-1024x733.png 1024w, https:\/\/synthnotes.ucsd.edu\/wp4\/wp-content\/uploads\/2022\/01\/Screen-Shot-2022-01-28-at-3.21.31-PM-300x215.png 300w, https:\/\/synthnotes.ucsd.edu\/wp4\/wp-content\/uploads\/2022\/01\/Screen-Shot-2022-01-28-at-3.21.31-PM-768x550.png 768w, https:\/\/synthnotes.ucsd.edu\/wp4\/wp-content\/uploads\/2022\/01\/Screen-Shot-2022-01-28-at-3.21.31-PM-624x447.png 624w, https:\/\/synthnotes.ucsd.edu\/wp4\/wp-content\/uploads\/2022\/01\/Screen-Shot-2022-01-28-at-3.21.31-PM.png 1492w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>3. Enter a &#8220;Product Name:&#8221;, select <strong>None<\/strong> for &#8220;Framework:&#8221; and <strong>Dynamic<\/strong> for &#8220;Type:&#8221;<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"747\" src=\"https:\/\/synthnotes.ucsd.edu\/wp4\/wp-content\/uploads\/2022\/01\/Screen-Shot-2022-01-28-at-3.25.08-PM-1024x747.png\" alt=\"\" class=\"wp-image-622\" srcset=\"https:\/\/synthnotes.ucsd.edu\/wp4\/wp-content\/uploads\/2022\/01\/Screen-Shot-2022-01-28-at-3.25.08-PM-1024x747.png 1024w, https:\/\/synthnotes.ucsd.edu\/wp4\/wp-content\/uploads\/2022\/01\/Screen-Shot-2022-01-28-at-3.25.08-PM-300x219.png 300w, https:\/\/synthnotes.ucsd.edu\/wp4\/wp-content\/uploads\/2022\/01\/Screen-Shot-2022-01-28-at-3.25.08-PM-768x560.png 768w, https:\/\/synthnotes.ucsd.edu\/wp4\/wp-content\/uploads\/2022\/01\/Screen-Shot-2022-01-28-at-3.25.08-PM-624x455.png 624w, https:\/\/synthnotes.ucsd.edu\/wp4\/wp-content\/uploads\/2022\/01\/Screen-Shot-2022-01-28-at-3.25.08-PM.png 1440w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>4. Click on your project (blue icon in left column) and <strong>Build Settings<\/strong> in the center panel. Set the following:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Deployment\n    Installation Build Products Location <strong>\/<\/strong>\n    Installation Directory (your project directory)\n    Skip Install No\nLinking\n    Other Linker Flags -flat_namespace -undefined suppress\nPackaging\n    Executable Extension pd_darwin\n    Executable Prefix (delete lib, leave empty)\n    Product Name (your external name)\nSearch Paths\n    Header Search Paths \/Applications\/Pd-0.51-4.app\/Contents\/Resources\/src (change for Pd version)<\/pre>\n\n\n\n<p>5. Add or create your external source code file (<em>externalname<\/em>.c). You might want to start with a known working file (obj1.c or dspobj.c) to start.<\/p>\n\n\n\n<p>6. You should now be able to build your external. Go to the product menu and select <strong>Build.<\/strong><\/p>\n\n\n\n<p>7. To debug your external, create a .pd file in the folder that your external resides. Assuming you started Pure Data to create this file, your next step is to connect the debugger.<\/p>\n\n\n\n<p>8. Go to the Debug menu and select <strong>Attach to Process<\/strong>. Do not attach to <strong>Pd<\/strong>, instead, scroll further down to the &#8220;System&#8221; section and select <strong>pd<\/strong>. This is the part of Pd that actually loads and runs your external.<\/p>\n\n\n\n<p>9. Now you can enter break points in the .c file. Xcode will stop execution at these points so that you can inspect variables and check whether things are working properly.<\/p>\n\n\n\n<p>10. Add your external to the .pd file you created in step 7. If all goes well, Xcode will jump to the foreground when it stops at the break point. Now you can look at variable and step through your code one line at a time.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Create a new project (New>Project&#8230; from file menu) Select macOS in the template dialog, and Library under Framework &amp; Library 3. Enter a &#8220;Product Name:&#8221;, select None for &#8220;Framework:&#8221; and Dynamic for &#8220;Type:&#8221; 4. Click on your project (blue icon in left column) and Build Settings in the center panel. Set the following: Deployment Installation [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-620","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/synthnotes.ucsd.edu\/wp4\/index.php\/wp-json\/wp\/v2\/posts\/620","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/synthnotes.ucsd.edu\/wp4\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/synthnotes.ucsd.edu\/wp4\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/synthnotes.ucsd.edu\/wp4\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/synthnotes.ucsd.edu\/wp4\/index.php\/wp-json\/wp\/v2\/comments?post=620"}],"version-history":[{"count":1,"href":"https:\/\/synthnotes.ucsd.edu\/wp4\/index.php\/wp-json\/wp\/v2\/posts\/620\/revisions"}],"predecessor-version":[{"id":623,"href":"https:\/\/synthnotes.ucsd.edu\/wp4\/index.php\/wp-json\/wp\/v2\/posts\/620\/revisions\/623"}],"wp:attachment":[{"href":"https:\/\/synthnotes.ucsd.edu\/wp4\/index.php\/wp-json\/wp\/v2\/media?parent=620"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/synthnotes.ucsd.edu\/wp4\/index.php\/wp-json\/wp\/v2\/categories?post=620"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/synthnotes.ucsd.edu\/wp4\/index.php\/wp-json\/wp\/v2\/tags?post=620"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}