{"id":941,"date":"2011-05-27T17:12:16","date_gmt":"2011-05-27T21:12:16","guid":{"rendered":"https:\/\/clarionsharp.com\/blog\/?p=941"},"modified":"2011-05-27T17:12:16","modified_gmt":"2011-05-27T21:12:16","slug":"clarion-net-update-2","status":"publish","type":"post","link":"https:\/\/clarionsharp.com\/blog\/clarion-net-update-2\/","title":{"rendered":"Clarion.Net update"},"content":{"rendered":"<p>An update for Clarion.Net is out today.\u00a0 It has a good number of fixes and delivers the previously described feature that automatically exposes Procedures you select so that they are visible to Clarion Win32 Apps.\u00a0 I wrote about this a while ago, so I&#8217;ll refresh you on it (this is straight from the Help file):<\/p>\n<p>1) In the Clarion# Program&#8217;s GLOBAL MAP, add both the NAME and PUBLIC attributes to the PROCEDURE  prototype<\/p>\n<p>For example in your Clarion# global Map:<\/p>\n<p>MAP<\/p>\n<p>! Procedures exposed for Win32 access must have both the  <span style=\"color: #008000;\">NAME and PUBLIC<\/span> attributes<br \/>\nSayHello \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0  PROCEDURE(),<span style=\"color: #008000;\">NAME<\/span>(&#8216;SayHello&#8217;),<span style=\"color: #008000;\">PUBLIC<\/span><br \/>\nSayTheName \u00a0 \u00a0 \u00a0 \u00a0 \u00a0  \u00a0PROCEDURE(string theName),<span style=\"color: #008000;\">NAME<\/span>(&#8216;SayTheName&#8217;),<span style=\"color: #008000;\">PUBLIC<\/span><\/p>\n<p>END<\/p>\n<p>2) On the Clarion# Project properties dialog, turn on the checkbox: <strong>Export Global named procedures and create Clarion  Win32 LIB file<\/strong><\/p>\n<p>This step causes a .LIB file to be created, its location is set according to  your RED file, or you can specify the output path in the Project<\/p>\n<p>3) Copy both the .LIB and the Clarion# DLL to your Win32 project folder. \u00a0You  also must copy any assemblies (DLLs) that your Clarion# DLL references, for the  minimum you need:<\/p>\n<p>SoftVelocity.Clarion.Runtime.Procedures.dll<br \/>\nSoftVelocity.Clarion.FileIO.dll<br \/>\nSoftVelocity.Clarion.Runtime.Classes.dll<br \/>\nClarionDrv.dll<\/p>\n<p>&nbsp;<\/p>\n<p>4) In the Clarion Win32 program prototype the Procedure(s), and add the PASCAL and DLL attributes. If you need to pass a string value by address also add the RAW attribute.<\/p>\n<p>MAP<\/p>\n<p>MODULE(&#8216;ManagedDLL.dll&#8217;)<\/p>\n<p>! Calling  Clarion# Procedures, you must use the <span style=\"color: #008000;\">PASCAL Attribute and set  DLL(true)<\/span><br \/>\nSayHello \u00a0 \u00a0 \u00a0 \u00a0 \u00a0  \u00a0PROCEDURE(),NAME(&#8216;SayHello&#8217;),<span style=\"color: #008000;\">PASCAL,DLL<\/span>(TRUE)<br \/>\nSayTheName \u00a0 PROCEDURE(*cstring  theName),NAME(&#8216;SayTheName&#8217;),<span style=\"color: #008000;\">PASCAL,RAW,DLL<\/span>(TRUE)<\/p>\n<p>END<\/p>\n<p>END<\/p>\n<p>&nbsp;<\/p>\n<p>In the initial implementation (its already changed internally),\u00a0 you might run into a &#8220;gotcha&#8221; when you get to step 2.\u00a0 In order to expose the Procedures for use in a Win32 program the binary Clarion# DLL file has to be disassembled back to IL code, the IL code is then modified, and then the IL code has to be assembled back to a binary (PE format) file.\u00a0 To do this there are two programs from the .Net SDK that have to be found; Ilasm and Ildasm.\u00a0 In the current implementation the location for those files is stored in an external .config file, and if they are not found (Ilasm and Ildasm), you&#8217;ll get an error message telling you to edit the path stored in Dllexport.exe.config.\u00a0 In the next release we&#8217;ll have an improved implementation that finds these automatically on all OS&#8217;s (32 or 64 bit).<\/p>\n<p>You&#8217;ll find an easy to understand example showing how this works in the .SamplesWin32toDotNet folder.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>An update for Clarion.Net is out today.\u00a0 It has a good number of fixes and delivers the previously described feature that automatically exposes Procedures you select so that they are visible to Clarion Win32 Apps.\u00a0 I wrote about this a while ago, so I&#8217;ll refresh you on it (this is straight from the Help file): &hellip; <a href=\"https:\/\/clarionsharp.com\/blog\/clarion-net-update-2\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Clarion.Net update<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,7],"tags":[],"class_list":["post-941","post","type-post","status-publish","format-standard","hentry","category-clarionnews","category-clarionsharp"],"_links":{"self":[{"href":"https:\/\/clarionsharp.com\/blog\/wp-json\/wp\/v2\/posts\/941","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/clarionsharp.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/clarionsharp.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/clarionsharp.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/clarionsharp.com\/blog\/wp-json\/wp\/v2\/comments?post=941"}],"version-history":[{"count":0,"href":"https:\/\/clarionsharp.com\/blog\/wp-json\/wp\/v2\/posts\/941\/revisions"}],"wp:attachment":[{"href":"https:\/\/clarionsharp.com\/blog\/wp-json\/wp\/v2\/media?parent=941"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/clarionsharp.com\/blog\/wp-json\/wp\/v2\/categories?post=941"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/clarionsharp.com\/blog\/wp-json\/wp\/v2\/tags?post=941"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}