久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何從 ruby?? 中調用 C++ 函數

How can I call C++ functions from within ruby(如何從 ruby?? 中調用 C++ 函數)
本文介紹了如何從 ruby?? 中調用 C++ 函數的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我是一名經驗豐富的 C/C++ 開發人員,但我是 Ruby 的新手.

如何在 Ruby 中調用 C++ 函數?

解決方案

你有 3 種可能性:

1) Ruby 能夠加載庫.即使有點棘手,您也可以決定編寫自己的加載程序并在 Ruby 中綁定您的 C++ 庫.這是使用所謂的擴展模塊完成的.您可以在此處找到綜合教程:http://www.rubyinside.com/how-to-create-a-ruby-extension-in-c-in-under-5-minutes-100.html

2) 您可以使用工具來圍繞您的 C++ 庫生成 Ruby 包裝器.以 SWIG 為例(http://www.swig.org/).您只需要以特定于 swig 的語法創建一個文件并將其提供給 SWIG.然后它將能夠為包括 Ruby 在內的多種語言生成包裝器.

3) 您可以選擇使用中間件,例如 CORBA/ICE/whatever.如果你只想調用一些 C++ 函數可能有點矯枉過正,但它可以讓你遠程調用這些函數,或者在中間件后面隱藏"一個網格.

I am an experienced C/C++ developer but I am a novice in Ruby.

How can I call a C++ function from with in Ruby?

解決方案

You have 3 possibilities :

1) Ruby is able to load libraries. Even if it is a bit tricky, you can decide to write your own loader and bind your C++ library in Ruby. This is done using what is called an extension module. You will find a comprehensive tutorial here: http://www.rubyinside.com/how-to-create-a-ruby-extension-in-c-in-under-5-minutes-100.html

2) You can use a tool that will generate the Ruby wrapper around your C++ library. Look at SWIG for example (http://www.swig.org/). You just have to create a file in a swig-specific syntax and provide it to SWIG. It will then be able to generate the wrapper for many languages, Ruby included.

3) You can choose to use a middleware, such as CORBA/ICE/whatever. It may be a bit overkill if you only want to call some C++ functions, but it will allow you to remote call the functions, or "hide" a grid behind the middleware.

這篇關于如何從 ruby?? 中調用 C++ 函數的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

boost_1_60_0 .zip installation in windows(Windows 中的 boost_1_60_0 .zip 安裝)
How do I get console output in C++ with a Windows program?(如何使用 Windows 程序在 C++ 中獲得控制臺輸出?)
How do I calculate the week number given a date?(如何計算給定日期的周數?)
OpenCV with Network Cameras(帶有網絡攝像機的 OpenCV)
Export all symbols when creating a DLL(創建 DLL 時導出所有符號)
Getting started with OpenCV 2.4 and MinGW on Windows 7(Windows 7 上的 OpenCV 2.4 和 MinGW 入門)
主站蜘蛛池模板: 国产91久久精品一区二区 | 亚洲精品成人网 | 99精品99 | 久久激情五月丁香伊人 | 日韩视频中文字幕 | 欧美三级电影在线播放 | 日韩在线不卡 | 日韩视频二区 | 二区三区在线观看 | 亚洲国产伊人 | 欧美韩一区二区 | 国产高清一区二区 | 亚洲精品99 | 成人免费淫片aa视频免费 | 91久久精品国产91久久 | 日韩免费一区 | www.夜夜骑 | 色婷婷国产精品 | 中文字幕综合在线 | 爱爱免费视频 | 91正在播放 | 日本视频免费观看 | 狠狠草视频 | 日本在线免费 | 午夜精品久久久久久久久久久久 | 午夜精品一区二区三区在线视频 | av网站免费在线观看 | 在线亚洲电影 | 欧美一级www片免费观看 | 99这里只有精品视频 | 精品国产欧美一区二区 | 欧美精品被 | 午夜影视 | 日韩一区二区三区在线 | 古装人性做爰av网站 | 久久福利电影 | 久草新在线 | 亚洲在线一区二区 | 影视一区| 国产精品九九 | 国产精品视频二区三区 |