<?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>Jeff Beard &#187; Business</title>
	<atom:link href="http://jeffbeard.org/category/business/feed/" rel="self" type="application/rss+xml" />
	<link>http://jeffbeard.org</link>
	<description>Blog.blog</description>
	<lastBuildDate>Sun, 01 Jan 2012 17:51:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>MySQL udf_median on Windows 7 64bit</title>
		<link>http://jeffbeard.org/2011/05/mysql-udf_median-on-windows-7-64bit/</link>
		<comments>http://jeffbeard.org/2011/05/mysql-udf_median-on-windows-7-64bit/#comments</comments>
		<pubDate>Sat, 21 May 2011 16:00:08 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Information Technology]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[udf]]></category>
		<category><![CDATA[udf on windows]]></category>
		<category><![CDATA[udf_median]]></category>
		<category><![CDATA[windows 7 64bit]]></category>

		<guid isPermaLink="false">http://jeffbeard.org/?p=290</guid>
		<description><![CDATA[In a minor but ongoing saga of supporting the venerable MySQL UDF function udf_median, I can now add a HOWTO for building it on Windows 7 x64 using Microsoft Visual C++ Express 2010. I should point out my previous article on the subject since there are parts of it that are still applicable. This is [...]]]></description>
			<content:encoded><![CDATA[<p>In a minor but ongoing saga of supporting the venerable MySQL UDF function udf_median, I can now add a HOWTO for building it on Windows 7 x64 using Microsoft Visual C++ Express 2010.<br />
<span id="more-290"></span></p>
<p>I should point out <a href="http://jeffbeard.org/2011/04/mysql-udf_median-on-windows">my previous article</a> on the subject since there are parts of it that are still applicable.</p>
<p>This is likely applicable to other MySQL UDFs as well but I haven&#8217;t tried.</p>
<p>I used the MySQL 5.1.57 x64 version for my system and I downloaded the zip archive rather than the installer. (Note that the server can still be installed as a service but you will need to run the cmd.exe program as an administrator in order to run the command line installation process.)</p>
<p>I also used Microsoft Visual C++ Express 2010 for this and my Windows version is Windows 7 Ultimate x64.</p>
<p>In addition to VS C++, you will also need the Windows SDK for Windows 7 which you can download <a href="http://www.microsoft.com/downloads/dlx/en-us/listdetailsview.aspx?FamilyID=6b6c21d2-2006-4afa-9702-529fa782d63b">here</a>. This addition is critical since it contains the x64 compiler and other tools.</p>
<p>When you have everything installed, follow the instructions on Roland Bouman&#8217;s <a href="http://rpbouman.blogspot.com/2007/09/creating-mysql-udfs-with-microsoft.html">blog post</a> about building UDFs on Windows but stop before building and installing the function then follow these steps to 64bit glory (if you are specifically using udf_median, you might also be interested in <a href="http://www.mooreds.com/wordpress/archives/376">this post</a>):</p>
<ol>
<li>Right-click on the project (not the solution), choose &#8220;Properties&#8221;. At the top of the dialog, from the &#8220;Configuration&#8221; dropdown, select &#8220;All Configurations&#8221;.<br/></li>
<li>Next expand &#8220;Configuration Properties&#8221; then select &#8220;General&#8221;. In the field on the right labeled &#8220;Platform Toolset&#8221; make sure the value &#8220;Windows7.1SDK&#8221; is selected<br/></li>
<li> Now let&#8217;s make it x64. At the top of the dialog box, click on the &#8220;Configuration Manager&#8221; button.<br/></li>
<li>In the resultant grid, select the &#8220;Platform&#8221; dropdown and choose &#8220;New&#8230;&#8221;. When the &#8220;New Project Platform&#8221; comes up, select x64 from the top dropdown then click &#8220;OK&#8221; then &#8220;Close&#8221; then close the Properties dialog.<br/></li>
<li>Now you can try building the project<br/></li>
<li>If the build is successful, you find the .dll, in my case ufd_median.dll, in the &#8220;Debug&#8221; or &#8220;Release&#8221; folder. Put that in the MySQL lib/plugin/ directory<br/></li>
<li>Install the plugin using SQL like this:<br />
           <code><br />
               CREATE AGGREGATE FUNCTION median RETURNS REAL SONAME 'udf_median.dll';<br />
           </code>
        </li>
</ol>
<p>And that should be it. </p>
<p>Here are a few things that I came across while setting up my project that might be helpful:</p>
<ol>
<li>In one instance the linker reported this error:<br />
            <code>1>LINK : fatal error LNK1104: cannot open file 'kernel32.lib'</code><br />
         The fix for this was making sure that the &#8220;Platform Toolset&#8221; in the project configuration properties was set to  &#8220;Windows7.1SDK&#8221;
        </li>
<li>If you get this error:<br />
        <code>ERROR 1126 (HY000): Can't open shared library 'file.dll'</code><br />
        this can sometimes mean that the .dll wasn&#8217;t compiled correctly (i.e. this is what you get when you try to use a 32bit .dll with a 64bit server) or the symbol exports didn&#8217;t work. I used the dumpbin program to make sure that the functions that needed to be exported were. Under the &#8220;Tools&#8221; menu in VC++, select &#8220;Visual Studio Command Prompt&#8221; then navigate to the directory with your .dll file and run this command:<br />
          <code>dumpbin  /exports udf_median.dll</code><br />
You should see the exported functions in the output.
        </li>
<li>I did not have to alter any of the C code to make this work even though I saw some comments on Roland&#8217;s post indicating that might be necessary.
        </li>
</ol>
<p>That&#8217;s about it. Feel free to contact me if you have any questions or if the steps didn&#8217;t work for you.</p>
]]></content:encoded>
			<wfw:commentRss>http://jeffbeard.org/2011/05/mysql-udf_median-on-windows-7-64bit/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using memcached
Page Caching using memcached
Object Caching 189/201 objects using memcached

Served from: jeffbeard.org @ 2012-05-20 06:36:01 -->
