{"id":944,"date":"2018-06-10T11:12:24","date_gmt":"2018-06-10T05:42:24","guid":{"rendered":"http:\/\/www.rangakrish.com\/?p=944"},"modified":"2018-06-10T13:17:31","modified_gmt":"2018-06-10T07:47:31","slug":"calling-lisp-functions-from-go-language","status":"publish","type":"post","link":"https:\/\/www.rangakrish.com\/index.php\/2018\/06\/10\/calling-lisp-functions-from-go-language\/","title":{"rendered":"Calling Lisp Functions from Go Language"},"content":{"rendered":"<p>In the <a href=\"http:\/\/www.rangakrish.com\/index.php\/2018\/05\/27\/calling-go-functions-from-lisp\/\" target=\"_blank\" rel=\"noopener\">previous post<\/a>, we saw how to invoke a <em><strong>Go<\/strong><\/em> function from <em><strong>Lisp<\/strong><\/em>. In today&#8217;s post, I would like to explain how to go in the other direction, namely, how to call <em><strong>Lisp<\/strong><\/em> functins from <em><strong>Go<\/strong><\/em>.<\/p>\n<p>There are two ways to do this. The first approach is to load the <em><strong>Lisp<\/strong><\/em> DLL (like any other DLL) in <em><strong>Go<\/strong><\/em> and make calls to functions in that DLL. The other, preferred approach, is to use a LIB (<em><strong>&#8220;.o&#8221;<\/strong><\/em>) file to statically bind to the DLL functions. Let me show both the approaches.<\/p>\n<h2><b>Building the Lisp DLL<\/b><\/h2>\n<p>Let us start with the Lisp side. As in the previous article, I am using <a href=\"http:\/\/www.lispworks.com\" target=\"_blank\" rel=\"noopener\"><em><strong>LispWorks Lisp<\/strong><\/em><\/a> (Windows &#8211; 64 bit) for the demo.<span class=\"Apple-converted-space\">\u00a0<\/span><\/p>\n<p>Here is a simple function that adds two 64-bit integers and returns the corresponding value:<\/p>\n<p style=\"padding-left: 30px;\"><span style=\"color: #0000ff;\">(fli:define-foreign-callable (&#8220;addIntLisp&#8221; :language :ansi-c :result-type :int64 :calling-convention :cdecl)<\/span><\/p>\n<p style=\"padding-left: 30px;\"><span style=\"color: #0000ff;\"><span class=\"Apple-converted-space\">\u00a0 \u00a0 <\/span>( (arg1 :int64) (arg2 :int64) )<span class=\"Apple-converted-space\">\u00a0 \u00a0<\/span><\/span><\/p>\n<p style=\"padding-left: 30px;\"><span style=\"color: #0000ff;\"><span class=\"Apple-converted-space\">\u00a0 <\/span>(+ arg1 arg2))<\/span><\/p>\n<p><em><strong>define-foreign-callable<\/strong><\/em> enables a Lisp function to be called from a foreign language, in this case, <em><strong>Go<\/strong><\/em>. Let us suppose that this function is defined in the file <em><strong>Exported Functions.lisp<\/strong><\/em>. Now we have to compile this function (plus the necessary Lisp runtime) into a DLL.<\/p>\n<p>We create another file called <em><strong>Generate DLL.lisp<\/strong><\/em> with the following code:<\/p>\n<p style=\"padding-left: 30px;\"><span style=\"color: #0000ff;\">(in-package &#8220;CL-USER&#8221;)<\/span><\/p>\n<p style=\"padding-left: 30px;\"><span style=\"color: #0000ff;\">(load-all-patches)<\/span><\/p>\n<p style=\"padding-left: 30px;\"><span style=\"color: #0000ff;\">(compile-file &#8220;Exported Functions.lisp&#8221;)<\/span><\/p>\n<p style=\"padding-left: 30px;\"><span style=\"color: #0000ff;\">(load &#8220;Exported Functions&#8221;)<\/span><\/p>\n<p style=\"padding-left: 30px;\"><span style=\"color: #0000ff;\">(defun dummy ())<\/span><\/p>\n<p style=\"padding-left: 30px;\"><span style=\"color: #0000ff;\">(compile &#8216;dummy)<\/span><\/p>\n<p style=\"padding-left: 30px;\"><span style=\"color: #0000ff;\">(deliver #&#8217;dummy<span class=\"Apple-converted-space\">\u00a0&#8220;Lisp-functions&#8221;\u00a01\u00a0:startup-bitmap-file nil\u00a0:keep-eval t\u00a0:keep-load-function t\u00a0:dll-exports &#8216;(&#8220;addIntLisp&#8221;))<\/span><\/span><\/p>\n<p style=\"padding-left: 30px;\"><span class=\"Apple-converted-space\" style=\"color: #0000ff;\">\u00a0<\/span><span style=\"color: #0000ff;\">(quit)<\/span><\/p>\n<p>I urge you to lookup the documentation of <em><strong>deliver<\/strong><\/em> function to understand the different parameters.<span class=\"Apple-converted-space\">\u00a0<\/span><\/p>\n<p>We are now ready to generate the DLL. Open a <em><strong>Command prompt<\/strong><\/em> and switch to the directory where these two files are located. Then run:<\/p>\n<p style=\"padding-left: 30px;\"><span style=\"color: #0000ff;\">&gt;<span class=\"Apple-converted-space\">\u00a0 <\/span>&#8220;C:\\Program Files\\LispWorks7.1\\lispworks-7-1-0-x64-windows.exe&#8221; -build &#8220;Generate DLL.lisp&#8221;<\/span><\/p>\n<p>This will result in a file called <em><strong>Lisp-functions.Dll<\/strong><\/em> in the current directory. We need this file to use with our Go program.<\/p>\n<h2><b>Using the DLL in Go<\/b><\/h2>\n<p><span style=\"text-decoration: underline;\">Approach-1a (Using the DLL directly):<\/span><\/p>\n<p>Here we use <em><strong>syscall.LoadLibrary()<\/strong><\/em> function in <em><strong>Go<\/strong><\/em> to load our DLL, followed by a call to <em><strong>syscall.GetProcAddress()<\/strong><\/em> to get the address of the desired function within the DLL. Finally, we use <em><strong>syscall.Syscall()<\/strong><\/em> to call into the loaded function and get the result. See the image below:<\/p>\n<figure id=\"attachment_946\" aria-describedby=\"caption-attachment-946\" style=\"width: 651px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/06\/LispCall.png\"><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" data-attachment-id=\"946\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2018\/06\/10\/calling-lisp-functions-from-go-language\/lispcall\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/06\/LispCall.png\" data-orig-size=\"651,928\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Direct DLL Call\" data-image-description=\"&lt;p&gt;Direct DLL Call&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Direct DLL Call&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/06\/LispCall.png\" class=\"size-full wp-image-946\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/06\/LispCall.png?resize=651%2C928\" alt=\"Direct DLL Call\" width=\"651\" height=\"928\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/06\/LispCall.png?w=651&amp;ssl=1 651w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/06\/LispCall.png?resize=210%2C300&amp;ssl=1 210w\" sizes=\"(max-width: 651px) 100vw, 651px\" \/><\/a><figcaption id=\"caption-attachment-946\" class=\"wp-caption-text\"><strong>Direct DLL Call<\/strong><\/figcaption><\/figure>\n<p>You can see a <em><strong>deferred<\/strong><\/em> call to a function named <em><strong>QuitLispWorks<\/strong><\/em>. This is the recommended way to terminate the LispWorks Lisp runtime as part of unloading the DLL. To run the Go program, do this:<\/p>\n<p style=\"padding-left: 30px;\">\u00a0<span style=\"color: #0000ff;\">&gt; go run LispCall.go<\/span><\/p>\n<p><span style=\"text-decoration: underline;\">Approach-1b (Using the DLL directly):<\/span><\/p>\n<p>There is a simpler way to load the DLL and call its functions. This is shown below:<\/p>\n<figure id=\"attachment_947\" aria-describedby=\"caption-attachment-947\" style=\"width: 550px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/06\/Lispcall2.png\"><img data-recalc-dims=\"1\" decoding=\"async\" data-attachment-id=\"947\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2018\/06\/10\/calling-lisp-functions-from-go-language\/lispcall2\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/06\/Lispcall2.png\" data-orig-size=\"550,530\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Direct DLL Call 2\" data-image-description=\"&lt;p&gt;Direct DLL Call 2&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Direct DLL Call 2&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/06\/Lispcall2.png\" class=\"size-full wp-image-947\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/06\/Lispcall2.png?resize=550%2C530\" alt=\"Direct DLL Call 2\" width=\"550\" height=\"530\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/06\/Lispcall2.png?w=550&amp;ssl=1 550w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/06\/Lispcall2.png?resize=300%2C289&amp;ssl=1 300w\" sizes=\"(max-width: 550px) 100vw, 550px\" \/><\/a><figcaption id=\"caption-attachment-947\" class=\"wp-caption-text\"><strong>Direct DLL Call 2<\/strong><\/figcaption><\/figure>\n<p>I wanted to show both approaches for the sake of documentation, but I guess most developers would prefer the simpler variant.\u00a0To run the Go program, do this:<\/p>\n<p style=\"padding-left: 30px;\">\u00a0<span style=\"color: #0000ff;\">&gt; go run LispCall2.go<\/span><\/p>\n<p><span style=\"text-decoration: underline;\">Approach-2 (Using <strong>&#8220;.o&#8221;<\/strong> file):<\/span><\/p>\n<p>If you have the LIB file corresponding to the DLL, along with the C header for the exported functions, then calling Lisp functions via the DLL becomes much easier.<\/p>\n<p>Since LispWorks does not create the LIB file as part of DLL generation, I looked around for some utility to generate the LIB from the DLL. Fortunately, I remembered that Embarcadero&#8217;s RAD Studio comes with <em><strong>implib<\/strong><\/em> utility, so I used it thus:<\/p>\n<p style=\"padding-left: 30px;\"><span style=\"color: #0000ff;\">&gt; implib Lisp-functions.o Lisp-functions.dll<\/span><\/p>\n<p>Note that the LIB file is named <em><strong>&#8220;.o&#8221;<\/strong><\/em> for compatibility with <em><strong>Go<\/strong><\/em> build system.<\/p>\n<p>I then created the Header file manually:<\/p>\n<p style=\"padding-left: 30px;\"><span style=\"color: #0000ff;\">#ifndef __LISP_FUNCTIONS_H__<\/span><\/p>\n<p style=\"padding-left: 30px;\"><span style=\"color: #0000ff;\">#define __LISP_FUNCTIONS_H__<\/span><\/p>\n<p style=\"padding-left: 30px;\"><span style=\"color: #0000ff;\">long addIntLisp(long arg1, long arg2);<\/span><\/p>\n<p style=\"padding-left: 30px;\"><span style=\"color: #0000ff;\">int __stdcall QuitLispWorks(int Force , int MilliTimeOut);<\/span><\/p>\n<p style=\"padding-left: 30px;\"><span style=\"color: #0000ff;\">#endif<\/span><\/p>\n<p>Here is the Go program (<em><strong>LispCall3.go<\/strong><\/em>) that calls the Lisp function:<\/p>\n<figure id=\"attachment_948\" aria-describedby=\"caption-attachment-948\" style=\"width: 492px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/06\/Lispcall3.png\"><img data-recalc-dims=\"1\" decoding=\"async\" data-attachment-id=\"948\" data-permalink=\"https:\/\/www.rangakrish.com\/index.php\/2018\/06\/10\/calling-lisp-functions-from-go-language\/lispcall3\/\" data-orig-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/06\/Lispcall3.png\" data-orig-size=\"492,235\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Lisp Call via LIB\" data-image-description=\"&lt;p&gt;Lisp Call via LIB&lt;\/p&gt;\n\" data-image-caption=\"&lt;p&gt;Lisp Call via LIB&lt;\/p&gt;\n\" data-large-file=\"https:\/\/www.rangakrish.com\/wp-content\/uploads\/2018\/06\/Lispcall3.png\" class=\"size-full wp-image-948\" src=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/06\/Lispcall3.png?resize=492%2C235\" alt=\"Lisp Call via LIB\" width=\"492\" height=\"235\" srcset=\"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/06\/Lispcall3.png?w=492&amp;ssl=1 492w, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/06\/Lispcall3.png?resize=300%2C143&amp;ssl=1 300w\" sizes=\"(max-width: 492px) 100vw, 492px\" \/><\/a><figcaption id=\"caption-attachment-948\" class=\"wp-caption-text\"><strong>Lisp Call via LIB<\/strong><\/figcaption><\/figure>\n<p>Take note of the comments before <em><strong>import &#8220;C&#8221;<\/strong><\/em>. These are required.<\/p>\n<p>For the second approach, we have the following files:<\/p>\n<p style=\"padding-left: 30px;\"><span style=\"color: #0000ff;\">&#8211; Lisp-functions.dll<\/span><\/p>\n<p style=\"padding-left: 30px;\"><span style=\"color: #0000ff;\">&#8211; Lisp-functions.o<\/span><\/p>\n<p style=\"padding-left: 30px;\"><span style=\"color: #0000ff;\">&#8211; Lisp-functions.h<\/span><\/p>\n<p style=\"padding-left: 30px;\"><span style=\"color: #0000ff;\">&#8211; LispCall3.go<\/span><\/p>\n<p>To build the <em><strong>Go<\/strong><\/em> executable from these files, run:<\/p>\n<p style=\"padding-left: 30px;\"><span style=\"color: #0000ff;\">&gt; go build LispCall3.go<\/span><\/p>\n<p>This creates <em><strong>LispCall3.exe<\/strong><\/em>. We have to distribute our DLL along with the executable if we are planning to run the program elsewhere. To run the program, enter:<\/p>\n<p style=\"padding-left: 30px;\"><span style=\"color: #0000ff;\">\u00a0&gt; LispCall3<\/span><\/p>\n<p style=\"padding-left: 30px;\"><span style=\"color: #0000ff;\">Lisp addInt: 300<\/span><\/p>\n<p>Good, the program works as expected! That completes today&#8217;s discussion on how to call <em><strong>LispWorks Lisp<\/strong><\/em> functions from <em><strong>Go<\/strong><\/em>. You can download the relevant files <a href=\"http:\/\/www.rangakrish.com\/downloads\/LispFromGo.zip\" target=\"_blank\" rel=\"noopener\">here<\/a>.<\/p>\n<p>Although I have not tried, I think the procedure should be similar for other Lisp environments on Windows.<\/p>\n<p>Hope you found today&#8217;s post useful.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the previous post, we saw how to invoke a Go function from Lisp. In today&#8217;s post, I would like to explain how to go in the other direction, namely, how to call Lisp functins from Go. There are two ways to do this. The first approach is to load the Lisp DLL (like any [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[141,18,17],"tags":[142,19,99],"class_list":["post-944","post","type-post","status-publish","format-standard","hentry","category-golang","category-lisp","category-programming","tag-go-language","tag-lisp","tag-lispworks"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9OLnF-fe","jetpack-related-posts":[{"id":2645,"url":"https:\/\/www.rangakrish.com\/index.php\/2021\/12\/25\/calling-lisp-functions-from-d-language\/","url_meta":{"origin":944,"position":0},"title":"Calling Lisp Functions from D Language","author":"admin","date":"December 25, 2021","format":false,"excerpt":"After exploring \"newLisp\" in the past few posts, I would like to start looking at the \"D Programming Language\"\u00a0(DLang). DLang\u00a0has been around since 2001. It was originally created by Walter Bright and later Andrei Alexandrescu joined the team in 2007. The main inspiration for DLang was C++, although it uses\u2026","rel":"","context":"In &quot;D Language&quot;","block_context":{"text":"D Language","link":"https:\/\/www.rangakrish.com\/index.php\/category\/d-language\/"},"img":{"alt_text":"Lisp Function Called from D","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/12\/Lisp-300x107.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/12\/Lisp-300x107.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2021\/12\/Lisp-300x107.jpg?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":3017,"url":"https:\/\/www.rangakrish.com\/index.php\/2023\/02\/16\/calling-external-dll-functions-from-julia\/","url_meta":{"origin":944,"position":1},"title":"Calling External DLL Functions from Julia","author":"admin","date":"February 16, 2023","format":false,"excerpt":"Julia supports calling external functions, especially those written in \u201cC\u201d language. As Julia documentation says, such calls do not involve any \u201cboilerplate\u201d code and hence are efficient. In today\u2019s article, I am going to show how to call functions defined in a DLL (Windows 64 bit). Instead of using direct\u2026","rel":"","context":"In &quot;Julia&quot;","block_context":{"text":"Julia","link":"https:\/\/www.rangakrish.com\/index.php\/category\/julia\/"},"img":{"alt_text":"The \"lispEval\" Function","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2023\/02\/code-300x117.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2023\/02\/code-300x117.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2023\/02\/code-300x117.jpg?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":963,"url":"https:\/\/www.rangakrish.com\/index.php\/2018\/06\/24\/calling-go-functions-from-lisp-part-2\/","url_meta":{"origin":944,"position":2},"title":"Calling Go Functions from Lisp &#8211; Part 2","author":"admin","date":"June 24, 2018","format":false,"excerpt":"In my earlier article Calling Go Functions from Lisp, I explained the steps for making calls to Go functions from another language, specifically LispWorks Lisp. Today, I want to give a slightly more\u00a0 interesting example showing the use of Go channels\u00a0through exported functions. Go is widely admired for its native\u2026","rel":"","context":"In &quot;Golang&quot;","block_context":{"text":"Golang","link":"https:\/\/www.rangakrish.com\/index.php\/category\/golang\/"},"img":{"alt_text":"Go Functions","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/06\/Go-Functions.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":928,"url":"https:\/\/www.rangakrish.com\/index.php\/2018\/05\/27\/calling-go-functions-from-lisp\/","url_meta":{"origin":944,"position":3},"title":"Calling Go Functions from Lisp","author":"admin","date":"May 27, 2018","format":false,"excerpt":"For the past few weeks I was travelling in the USA and had the pleasure of meeting several friends, some of whom are senior developers and architects. It was interesting to learn that many of them were either using Go language in their daily work, or were passionately endorsing the\u2026","rel":"","context":"In &quot;Golang&quot;","block_context":{"text":"Golang","link":"https:\/\/www.rangakrish.com\/index.php\/category\/golang\/"},"img":{"alt_text":"Part of Header File","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/05\/Header-file.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/05\/Header-file.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2018\/05\/Header-file.png?resize=525%2C300 1.5x"},"classes":[]},{"id":2057,"url":"https:\/\/www.rangakrish.com\/index.php\/2020\/07\/19\/calling-lisp-functions-from-elixir\/","url_meta":{"origin":944,"position":4},"title":"Calling Lisp Functions from Elixir","author":"admin","date":"July 19, 2020","format":false,"excerpt":"In the last article\u00a0I showed how we can simulate the idea of Lisp's \"closure\" in Elixir. Today, I would like to demonstrate how we can call Lisp functions from Elixir using the NIF interface. What is the need to integrate Elixir with another language? I can think of two reasons:\u2026","rel":"","context":"In &quot;Elixir&quot;","block_context":{"text":"Elixir","link":"https:\/\/www.rangakrish.com\/index.php\/category\/elixir\/"},"img":{"alt_text":"Using the Lisp Functions","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2020\/07\/Session.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2020\/07\/Session.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2020\/07\/Session.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2020\/07\/Session.jpg?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":3070,"url":"https:\/\/www.rangakrish.com\/index.php\/2023\/04\/02\/building-v-language-dll\/","url_meta":{"origin":944,"position":5},"title":"Building V Language DLL","author":"admin","date":"April 2, 2023","format":false,"excerpt":"The relatively new V Programming Language (Vlang) boasts of some interesting features such as \u201cfast compilation\u201d and runtime performance \u201cas fast as C\u201d, at the same time being a \u201csimple language\u201d. As I normally do with other languages that I learn and use, I decided to see how easy it\u2026","rel":"","context":"In &quot;Programming&quot;","block_context":{"text":"Programming","link":"https:\/\/www.rangakrish.com\/index.php\/category\/programming\/"},"img":{"alt_text":"V Program","src":"https:\/\/i0.wp.com\/www.rangakrish.com\/wp-content\/uploads\/2023\/04\/V-source-267x300.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts\/944","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/comments?post=944"}],"version-history":[{"count":0,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/posts\/944\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/media?parent=944"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/categories?post=944"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rangakrish.com\/index.php\/wp-json\/wp\/v2\/tags?post=944"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}