<?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>新的开始 &#187; 程序设计</title>
	<atom:link href="http://www.wangtianqi.com/blog/category/computer/programing/feed" rel="self" type="application/rss+xml" />
	<link>http://www.wangtianqi.com/blog</link>
	<description>每一天都是新的开始</description>
	<lastBuildDate>Mon, 12 Sep 2011 10:42:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>linux程序如何支持插件</title>
		<link>http://www.wangtianqi.com/blog/190</link>
		<comments>http://www.wangtianqi.com/blog/190#comments</comments>
		<pubDate>Mon, 27 Jul 2009 09:01:21 +0000</pubDate>
		<dc:creator>czyhd</dc:creator>
				<category><![CDATA[程序设计]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[插件]]></category>
		<category><![CDATA[编程]]></category>

		<guid isPermaLink="false">http://www.wangtianqi.com/190</guid>
		<description><![CDATA[今天小猴同学在研究这个，我也看了下。

给两段代码

1，插件部分，so.c

<span class="readmore"><a href="http://www.wangtianqi.com/blog/190" title="linux程序如何支持插件">阅读全文——共550字</a></span>]]></description>
			<content:encoded><![CDATA[<p>今天小猴同学在研究这个，我也看了下。</p>
<p>给两段代码</p>
<p>1，插件部分，so.c</p>
<blockquote><p>int add( int a, int b){<br />
return a+b;<br />
}</p></blockquote>
<p>编译</p>
<p>gcc -c -fPIC so.c</p>
<p>gcc -shared -fPIC so.o -o so.so</p>
<p><span id="more-190"></span></p>
<p>2,主程序部分，main.c</p>
<blockquote><p>#include &lt;stdio.h&gt;<br />
#include &lt;dlfcn.h&gt;<br />
int (*add)(int x,int y);<br />
int main(){<br />
int a,b;<br />
char so_filename[20]=”./so.so”;<br />
void *p;<br />
char *error;<br />
p=dlopen(so_filename,RTLD_LAZY);<br />
if (p==NULL){<br />
fprintf(stderr,dlerror());<br />
return 2;<br />
}<br />
add=dlsym(p,”add”);<br />
error=dlerror();<br />
if (error){<br />
fprintf(stderr,error);<br />
return 3;<br />
}<br />
scanf(“%d %d”,&amp;a,&amp;b);<br />
printf(“%d+%d=%d.\n”,a,b,add(a,b));<br />
dlclose(p);<br />
return 0;<br />
}</p></blockquote>
<p>编译：</p>
<p>gcc main.c -ldl -o main</p>
<p>注意要加-ldl</p>
<p>源程序要包含dlfcn.h头，用dlopen装载插件，用dlsym来找到函数add的地址，然后调用就好<code><span style="color: #000000;"></span></code></p>
<h3  class="related_post_title">相关主题</h3><ul class="related_post"><li><a href="http://www.wangtianqi.com/blog/236" title="linux下安装rt3070驱动">linux下安装rt3070驱动</a></li><li><a href="http://www.wangtianqi.com/blog/207" title="Linux下密码很脆弱">Linux下密码很脆弱</a></li><li><a href="http://www.wangtianqi.com/blog/183" title="升级了一下显卡驱动">升级了一下显卡驱动</a></li><li><a href="http://www.wangtianqi.com/blog/174" title="安装内核的一个错误">安装内核的一个错误</a></li><li><a href="http://www.wangtianqi.com/blog/171" title="关于内核编译">关于内核编译</a></li><li><a href="http://www.wangtianqi.com/blog/169" title="ubuntu 9.04的优化">ubuntu 9.04的优化</a></li><li><a href="http://www.wangtianqi.com/blog/162" title="突然发现swap分区的利用率太低了">突然发现swap分区的利用率太低了</a></li><li><a href="http://www.wangtianqi.com/blog/148" title="ubuntu下制作ISO镜像文件">ubuntu下制作ISO镜像文件</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.wangtianqi.com/blog/190/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>玩了一下Brainfuck</title>
		<link>http://www.wangtianqi.com/blog/140</link>
		<comments>http://www.wangtianqi.com/blog/140#comments</comments>
		<pubDate>Sat, 27 Dec 2008 11:18:02 +0000</pubDate>
		<dc:creator>czyhd</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[程序设计]]></category>
		<category><![CDATA[brainfuck]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[有趣]]></category>

		<guid isPermaLink="false">http://www.wangtianqi.com/140</guid>
		<description><![CDATA[很意外的发现ubuntu有个bf命令,然后装上了,一种很扯淡的语言..

随手写了一个..

++++++++++

<span class="readmore"><a href="http://www.wangtianqi.com/blog/140" title="玩了一下Brainfuck">阅读全文——共265字</a></span>]]></description>
			<content:encoded><![CDATA[<p>很意外的发现ubuntu有个bf命令,然后装上了,一种很扯淡的语言..</p>
<p>随手写了一个..</p>
<blockquote><p>++++++++++<br />
[<br />
&gt;+++++++&gt;+++&gt;++++++++++&gt;++++++++++++&gt;+&lt;&lt;&lt;&lt;&lt;-<br />
]<br />
&gt;+++.<br />
&gt;++.<br />
&gt;++++++++.<br />
+++.<br />
+++++++.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;.<br />
&lt;.<br />
&gt;&gt;+.<br />
&lt;&lt;+.<br />
&gt;&gt;&gt;.</p></blockquote>
<p>存在一个文件里,比如temp,然后在终端执行</p>
<blockquote><p>bf temp</p></blockquote>
<p>会打印一行字符..</p>
<blockquote><p>I love Y!</p></blockquote>
<p>其实还是蛮好玩的,参见</p>
<p><a href="http://en.wikipedia.org/wiki/Brainfuck">http://en.wikipedia.org/wiki/Brainfuck</a></p>
<p>改改名字就更好了..</p>
<h3  class="related_post_title">相关主题</h3><ul class="related_post"><li><a href="http://www.wangtianqi.com/blog/139" title="发现wanda小鱼蛮有意思的">发现wanda小鱼蛮有意思的</a></li><li><a href="http://www.wangtianqi.com/blog/183" title="升级了一下显卡驱动">升级了一下显卡驱动</a></li><li><a href="http://www.wangtianqi.com/blog/169" title="ubuntu 9.04的优化">ubuntu 9.04的优化</a></li><li><a href="http://www.wangtianqi.com/blog/162" title="突然发现swap分区的利用率太低了">突然发现swap分区的利用率太低了</a></li><li><a href="http://www.wangtianqi.com/blog/148" title="ubuntu下制作ISO镜像文件">ubuntu下制作ISO镜像文件</a></li><li><a href="http://www.wangtianqi.com/blog/143" title="MOCP的配置">MOCP的配置</a></li><li><a href="http://www.wangtianqi.com/blog/138" title="ubuntu下MP3乱码的完美解决方案">ubuntu下MP3乱码的完美解决方案</a></li><li><a href="http://www.wangtianqi.com/blog/132" title="ubuntu下安装wordpress">ubuntu下安装wordpress</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.wangtianqi.com/blog/140/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>一个简单的huffman压缩程序</title>
		<link>http://www.wangtianqi.com/blog/68</link>
		<comments>http://www.wangtianqi.com/blog/68#comments</comments>
		<pubDate>Sun, 27 Apr 2008 12:11:05 +0000</pubDate>
		<dc:creator>czyhd</dc:creator>
				<category><![CDATA[程序设计]]></category>
		<category><![CDATA[c]]></category>
		<category><![CDATA[huffman]]></category>

		<guid isPermaLink="false">http://cnc.wangtianqi.com/word/?p=68</guid>
		<description><![CDATA[基于huffman编码

压缩非常有限

原来用pascal写过,

<span class="readmore"><a href="http://www.wangtianqi.com/blog/68" title="一个简单的huffman压缩程序">阅读全文——共98字</a></span>]]></description>
			<content:encoded><![CDATA[<p>基于huffman编码<br />
压缩非常有限</p>
<p>原来用pascal写过,<br />
但是由于编码问题,<br />
很多文件会越压越大</p>
<p>现在用c重新写了一下,<br />
算是把那项工作完成了吧~~~</p>
<p><a href="/wordpress/wp-content/uploads/2008/04/compress.rar">点击下载 </a></p>
<p>用dev c++在windows xp下测试通过</p>
<h3  class="related_post_title">相关主题</h3><ul class="related_post"><li><a href="http://www.wangtianqi.com/blog/14" title="很不错的代码">很不错的代码</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.wangtianqi.com/blog/68/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>关于搜索的ppt</title>
		<link>http://www.wangtianqi.com/blog/22</link>
		<comments>http://www.wangtianqi.com/blog/22#comments</comments>
		<pubDate>Thu, 24 May 2007 19:27:01 +0000</pubDate>
		<dc:creator>czyhd</dc:creator>
				<category><![CDATA[程序设计]]></category>
		<category><![CDATA[搜索]]></category>

		<guid isPermaLink="false">http://cnc.wangtianqi.com/word/?p=22</guid>
		<description><![CDATA[答应许哥去一中讲搜索的&#8230;然后就和ghost写了个ppt,感觉并没有多少技术含量&#8230;&#8230;帖这里了&#8230;[file][attach]12[/attach][/file]

随机日志给apt-get添加代理豆瓣阿尔法城抢座位脚本arch下ibus的光标跟随问题升级了一下显卡驱动ubuntu 9.04果然不错啊～blog挂了一周做了个简单的网址缩短服务MOCP的配置

]]></description>
			<content:encoded><![CDATA[<p>答应许哥去一中讲搜索的&#8230;然后就和ghost写了个ppt,感觉并没有多少技术含量&#8230;&#8230;<br/>帖这里了&#8230;<br/>[file][attach]12[/attach][/file]<br/></p>
<h3  class="related_post_title">随机日志</h3><ul class="related_post"><li><a href="http://www.wangtianqi.com/blog/146" title="Google Sync开始提供免费的手机同步服务了">Google Sync开始提供免费的手机同步服务了</a></li><li><a href="http://www.wangtianqi.com/blog/68" title="一个简单的huffman压缩程序">一个简单的huffman压缩程序</a></li><li><a href="http://www.wangtianqi.com/blog/67" title="ubuntu 8.04 发布了">ubuntu 8.04 发布了</a></li><li><a href="http://www.wangtianqi.com/blog/113" title="把blog换成wordpress了&#8230;">把blog换成wordpress了&#8230;</a></li><li><a href="http://www.wangtianqi.com/blog/17" title="ubuntu安装">ubuntu安装</a></li><li><a href="http://www.wangtianqi.com/blog/153" title="GNOME DO 很好用">GNOME DO 很好用</a></li><li><a href="http://www.wangtianqi.com/blog/190" title="linux程序如何支持插件">linux程序如何支持插件</a></li><li><a href="http://www.wangtianqi.com/blog/90" title="ubuntu 8.10&#8230;">ubuntu 8.10&#8230;</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.wangtianqi.com/blog/22/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>很不错的代码</title>
		<link>http://www.wangtianqi.com/blog/14</link>
		<comments>http://www.wangtianqi.com/blog/14#comments</comments>
		<pubDate>Mon, 19 Mar 2007 19:03:25 +0000</pubDate>
		<dc:creator>czyhd</dc:creator>
				<category><![CDATA[程序设计]]></category>
		<category><![CDATA[c]]></category>

		<guid isPermaLink="false">http://cnc.wangtianqi.com/word/?p=14</guid>
		<description><![CDATA[猜猜这个代码是干什么的?^_^编译运行看看,圆周率,800位!

#include 

long a=10000,b,c=2800,d,e,f&#91;2801&#93;,g;

<span class="readmore"><a href="http://www.wangtianqi.com/blog/14" title="很不错的代码">阅读全文——共214字</a></span>]]></description>
			<content:encoded><![CDATA[<p>猜猜这个代码是干什么的?<br/>^_^<br/>编译运行看看,圆周率,800位!<br/><br/><br/><coolcode><br />
#include <stdio.h><br />
long a=10000,b,c=2800,d,e,f&#91;2801&#93;,g;<br />
main()<br />
{for(;b-c;)f&#91;b++&#93;=a/5;<br />
for(;d=0,g=c*2;c-=14,printf(“%.4d”,e+d/a),e=d%a)<br />
for(b=c;d+=f&#91;b&#93;*a,f&#91;b&#93;=d%&#8211;g,d/=g&#8211;,&#8211;b;d*=b);<br />
}<br />
</coolcode><br/><br/><br/><br/>此代码是ghost发给我的&#8230;. <br/></p>
<h3  class="related_post_title">相关主题</h3><ul class="related_post"><li><a href="http://www.wangtianqi.com/blog/68" title="一个简单的huffman压缩程序">一个简单的huffman压缩程序</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.wangtianqi.com/blog/14/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

