<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>harbour &#8211; Virtually Fun</title>
	<atom:link href="https://virtuallyfun.com/category/harbour/feed/" rel="self" type="application/rss+xml" />
	<link>https://virtuallyfun.com</link>
	<description>Fun with Virtualization</description>
	<lastBuildDate>Sun, 06 Jun 2010 21:12:00 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.2</generator>
	<item>
		<title>Taking Clipper to the Harbour</title>
		<link>https://virtuallyfun.com/2010/06/06/taking-clipper-to-the-harbour/</link>
					<comments>https://virtuallyfun.com/2010/06/06/taking-clipper-to-the-harbour/#respond</comments>
		
		<dc:creator><![CDATA[neozeed]]></dc:creator>
		<pubDate>Sun, 06 Jun 2010 21:12:00 +0000</pubDate>
				<category><![CDATA[clipper]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[harbour]]></category>
		<guid isPermaLink="false">https://virtuallyfun.com/?p=245</guid>

					<description><![CDATA[In the last instance, I left with an example of running a Clipper 87 program compiled with a simple C routine, then rebuilt that with Clipper 5.3 using both a 286 &#038; 386 Dos extender. The next step will be &#8230; <a href="https://virtuallyfun.com/2010/06/06/taking-clipper-to-the-harbour/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p>In the last instance, I left with an example of running a Clipper 87 program compiled with a simple C routine, then rebuilt that with Clipper 5.3 using both a 286 &#038; 386 Dos extender.</p>
<p>The next step will be taking that program and making a win32 exe.  </p>
<p>And for that we are going to use this great program <a href="http://www.harbour-project.org/">harbour</a>.</p>
<p>Much like <a href="http://virtuallyfun.blogspot.com/2009/09/zork-via-fortran.html">f2c</a>, harbour translates dBase PRG files into either C, or a p-code VM just like clipper did.  For this example, I just downloaded Harbour from <a href="http://sourceforge.net/projects/harbour-project/">sourceforge</a>, and installed it in my c:\hmg directory.</p>
<p>Porting applications is pretty straight forward, however Harbour needs a &#8216;main&#8217; procedure to exist in order to work correctly.  So the first change to my simple clipper program is to create wrap my simple Clipper program in a main procedure.</p>
<p>HI.PRG</p>
<blockquote><p>procedure main<br />? &#8220;hello from clipper&#8221;<br />? &#8220;&#8221;<br />c_hi()<br />return</p></blockquote>
<p>Now the C program needs some changes as well.  Notice how this looks very different from the old c program, but at the same time, it&#8217;s not too different.  Also because harbour translates the clipper into C, stdio is now working correctly so I can use printf.</p>
<p>HI_C.C</p>
<blockquote><p>#include &#8220;hbvmpub.h&#8221;<br />#include &#8220;hbinit.h&#8221;</p>
<p>HB_FUNC( C_HI )<br />{<br />printf(&#8220;hi from C\n&#8221;);<br />}</p></blockquote>
<p>Now to setup the environment, translate the clipper, build the c program and link them together&#8230;.</p>
<blockquote><p>\hmg\MINGW\mingwvars.bat</p>
<p>\hmg\HARBOUR\bin\harbour.exe hi.prg -m</p>
<p>gcc hi_c.c -I\hmg\harbour\include -c</p>
<p>gcc -mconsole hi.c hi_c.c -I\hmg\harbour\include    -mconsole -Wl,&#8211;start-group -lhbextern -lhbdebug -lhbvm -lhbrtl -lhblang -lhbcpage -lgtcgi -lgtpca -lgtstd -lgtwin -lgtwvt -lgtgui -lhbrdd -lhbuddall -lhbusrrdd -lrddntx -lrddcdx -lrddnsx -lrddfpt -lhbrdd -lhbhsx -lhbsix -lhbmacro -lhbcplr -lhbpp -lhbcommon -lkernel32 -luser32 -lgdi32 -ladvapi32 -lws2_32 -lwinspool -lcomctl32 -lcomdlg32 -lshell32 -luuid -lole32 -loleaut32 -lmpr -lwinmm -lmapi32 -limm32 -lmsimg32 -lwininet -lhbpcre -lhbzlib  -Wl,&#8211;end-group -ohi.exe -LC:/hmg/HARBOUR/lib</p></blockquote>
<p>And running this gives me:</p>
<blockquote><p>C:\temp>hi</p>
<p>hello from clipper<br />hi from C</p>
<p>C:\temp></p></blockquote>
<p>Now I know there is all kinds of front ends and other fun stuff, however I think it&#8217;s good to know how the thing actually works&#8230; </p>
<p>What is even more cool about Harbour is that once you get your program working there, it can be easily rebuilt for OS/2, Linux, Win32, Win64, Windows CE and a few other platforms where GCC is available.</p>
<p>And the best part is that they won&#8217;t soak up 100% of your CPU!!!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://virtuallyfun.com/2010/06/06/taking-clipper-to-the-harbour/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
