因为项目原因,需要使用到rabbitmq的c客户端库。首先,参见上一篇windows下openssl编译,如果已经使用cmake编译过了,则先delete cache(File-Delete Cache),否则原来的cmake缓存都在了,将仍然会出现原来的错误。

依次点击configire、generate,可以生成vs sln。如下:

最后使用VS即可生成rabbitmq.4.dll,如下:

测试自带的例子:

D:\RabbitMQ Server\rabbitmq_server-3.6.5\sbin>cd /d D:\rabbitmq-c-0.8.0-build\examples\Debug

D:\rabbitmq-c-0.8.0-build\examples\Debug>amqp_listen localhost 5672 amq.direct test
Delivery 1, exchange amq.direct routingkey test
Content-type: text/plain
----
00000000: 68 65 6C 6C 6F 20 77 6F : 72 6C 64 hello world
0000000B:
Delivery 2, exchange amq.direct routingkey test
Content-type: text/plain
----
00000000: 68 65 6C 6C 6F 20 77 6F : 72 6C 64 hello world
0000000B:
Delivery 3, exchange amq.direct routingkey test
Content-type: text/plain
----
00000000: 68 65 6C 6C 6F 20 77 6F : 72 6C 64 hello world
0000000B:
Delivery 4, exchange amq.direct routingkey test

新开一个窗口,执行如下:

D:\RabbitMQ Server\rabbitmq_server-3.6.5\sbin>cd /d D:\rabbitmq-c-0.8.0-build\examples\Debug

D:\rabbitmq-c-0.8.0-build\examples\Debug>amqp_sendstring localhost 5672 amq.direct test "hello world"

D:\rabbitmq-c-0.8.0-build\examples\Debug>amqp_sendstring localhost 5672 amq.direct test "hello world"

D:\rabbitmq-c-0.8.0-build\examples\Debug>amqp_sendstring localhost 5672 amq.direct test "hello world"

D:\rabbitmq-c-0.8.0-build\examples\Debug>amqp_sendstring localhost 5672 amq.direct test "hello world"

D:\rabbitmq-c-0.8.0-build\examples\Debug>amqp_sendstring localhost 5672 amq.direct test "hello world"

D:\rabbitmq-c-0.8.0-build\examples\Debug>amqp_sendstring localhost 5672 amq.direct test "hello world"

D:\rabbitmq-c-0.8.0-build\examples\Debug>amqp_sendstring localhost 5672 amq.direct test "hello world"

需要注意的是,librabbitmq的channel不是线程安全的,因此需要应用自行保证线程安全性,如下所述:

Threading

You cannot share a socket, an amqp_connection_state_t, or a channel between threads using librabbitmq. The librabbitmqlibrary is built with event-driven, single-threaded applications in mind, and does not yet cater to any of the requirements of pthreaded applications.

Your applications instead should open an AMQP connection (and an associated socket, of course) per thread. If your program needs to access an AMQP connection or any of its channels from more than one thread, it is entirely responsible for designing and implementing an appropriate locking scheme. It will generally be much simpler to have a connection exclusive to each thread that needs AMQP service.

官方主页https://github.com/alanxz/rabbitmq-c

doc api http://alanxz.github.io/rabbitmq-c/docs/0.8.0/classes.html

剩下的就是慢慢啃主要的api了。

windows下rabbitmq-c编译(带openssl、无需MinGW)的更多相关文章

  1. 【转】Windows下使用VS2008编译OpenCV 2.1 添加Intel TBB和Python支持

    Windows下使用VS2008编译OpenCV2.1 添加Intel TBB和Python支持 步骤: 1.仔细阅读OpenCV官网上的InstallGuide:http://opencv.will ...

  2. 实践详细篇-Windows下使用VS2015编译的Caffe训练mnist数据集

    上一篇记录的是学习caffe前的环境准备以及如何创建好自己需要的caffe版本.这一篇记录的是如何使用编译好的caffe做训练mnist数据集,步骤编号延用上一篇 <实践详细篇-Windows下 ...

  3. windows下用vs2010编译ffmpeg

    转载自;http://q1q2q3q4q5q6ln.blog.163.com/blog/static/500794332014666536283/ (注意:请务必先阅读:七,后记补充:) ffmpeg ...

  4. Windows下从源代码编译Skia

    在PPAPI里面画图,能够结合第三方的图形库.比方Cairo.Skia. Google Chrome.Chromium和Android都使用Skia作为画图引擎.我也来试试Skia,先过编译关. fo ...

  5. Windows 下使用 GNUstep 编译并运行 Objective-C 程序

    今晚上开始看<Objective-C 程序设计(第4版)>这本书(OSChina 正在做此书的书评活动,详情请看这里),到现在为止看到第 7 章,于是想动手试试写两简单的程序编译跑跑看. ...

  6. 在windows下使用vs2013编译和调试mysql源代码

    1. 准备工作 1)OS:win10 + VS2013 2)mysql 源码(windows版):mysql-5.6.25.zip 3)perl tool:ActivePerl-5.16.3.1604 ...

  7. Windows下RabbitMQ安装,部署,配置

    安装部署 1.当前环境以及参考资料出处 部署环境:windows server 2008 r2 enterprise 官方安装部署文档:http://www.rabbitmq.com/install- ...

  8. 在Windows下利用php自带的mail函数发邮件

    这几天看<Head First PHP & MySQL>,里面有发邮件的例子是用系统自带的mail函数发送的,自己照书上写的试了一直不成功,后来终于在网上找到解决方案,现在总结下. ...

  9. Win7 下用 VS2015 编译最新 openssl(1.0.2j)包含32、64位debug和release版本的dll、lib(8个版本)

    Win7 64位系统下通过VS2015编译好的最新的OpenSSL(1.0.2j)所有八个版本的链接库, 包含以下八个版本: 1.32位.debug版LIB: 2.32位.release版LIB: 3 ...

  10. Windows下RabbitMQ安装及入门

    1.Windows下安装RabbitMQ需要以下几个步骤 (1):下载erlang,原因在于RabbitMQ服务端代码是使用并发式语言erlang编写的,下载地址:http://www.erlang. ...

随机推荐

  1. sess.run() 中的fetches和feed_dict

    sess.run()由fetches和feed_dict组成 sess.run(fetches,feed_dict) sess.run是让fetches节点动起来,告诉tensorflow,想要此节点 ...

  2. Linux配置eclipse实践

    有几年没有在Linux下用eclipse开发了,几年前是在CentOS 7下用eclipse开发的,好像用的还是较新的版本.最近有个项目要求在centos 下卡发,装上eclipse-cdt后,建立项 ...

  3. go https json

    好吧,再来一个看起来高档点的吧 自从知道 Go有本地调用后,我就回到windows了 哈哈,以下内容,均在win10下搞定 预备:先做两个文件,服务器端的私钥KEY和公钥证书 1. openssl g ...

  4. Golang package

    今天,灵感一现:不能一个文件干到底吧,那要是工程大了怎么办? 答案很简单,“包”啊 GO里的包,看起来很简单,但又不简单 一开始,我想当然的以为就是include 路径一样的问题 事实是,GO以GOP ...

  5. Cocos Creator 计时器的延时循环试用方法

    *****计时器的一些运用***** //计算1次的计时器,2秒后执行 this.scheduleOnce(function(){ this.doSomething(); },2); //每隔5秒执行 ...

  6. arrow

    1.c++(OOGP) 与数据结构与算法 1.一定要有一门自己比较熟悉的语言. 我由于使用C++比较多,所以简历上只写了C++.C++的特性要了解,C++11要了解一些,还有STL.面试中常遇到的一些 ...

  7. sqli-labs(六)

    第十一关: 这关是一个登陆口,也是一个sql注入的漏洞,也就是常说的万能密码. 在输入框账号密码种分别输入 1'  和1'  页面会报错. 后台使用的单引符号进行的拼接.账号输入1' or '1'=' ...

  8. DataGridView控件用法合集

    1.当前的单元格属性取得.变更 Console.WriteLine(DataGridView1.CurrentCell.Value) Console.WriteLine(DataGridView1.C ...

  9. c# 修改xml格式config文件

    xml 格式的config文件如下: <?xml version="1.0" encoding="utf-8"?> <configuratio ...

  10. spring 源码导入eclipse(sts)

    一. 准备工作 1.下载安装sts(springsource推荐使用) 下载地址: http://www.springsource.org/downloads/sts-ggts 2.下载安装gradl ...