时间:2020-01-22 08:47  编辑:admin

援用自golang下级编程2.1节

接心文件hello.h是hello模块的真现者战利用者配合的商定,可是该商定并出有要供必需利用C言语去真现接心。我们能够用没有同言语去从头真现那个C言语函数.也是道我们能够利用没有同言语没有同语法去真现那个功效,只要那个功效被重写便可.

.h文件接心内容:

<pre spellcheck="false" class="md-fences md-end-block contain-cm modeLoaded" lang="hpp" contenteditable="false" cid="n117" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: Consolas, "Liberation Mono", Courier, monospace; font-size: 0.9em; white-space: normal; display: block; break-inside: avoid; text-align: left; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(223, 226, 229); border-radius: 3px; padding: 8px 1em 6px; margin-bottom: 15px; margin-top: 15px; width: inherit; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">void SayHello(const char* s);</pre>

main文件内容:

<pre spellcheck="false" class="md-fences md-end-block contain-cm modeLoaded" lang="go" contenteditable="false" cid="n203" mdtype="fences" style="box-sizing: border-box; overflow: visible; font-family: Consolas, "Liberation Mono", Courier, monospace; font-size: 0.9em; white-space: normal; display: block; break-inside: avoid; text-align: left; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(223, 226, 229); border-radius: 3px; padding: 8px 1em 6px; margin-bottom: 15px; margin-top: 15px; width: inherit; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">package main

//#include"hello.h"
import (
"C"
)

func main() {
C.SayHello(C.CString("Hello, World\n"))
}</pre>

利用//#include"hello.h"去import出去c的头文件hello.h.注重那里必需正在import语句上里界说且没有能有空止,可则编译器会报错.

标签: Drupal 中文  

Drupal安全更新

亚艾元软件以Drupal为基础,推动Drupal的中国化、Drupal教程中文化、将Drupal与微信相结合,服务广大的中国Drupal用户。

最近Drupal安全升级频繁,亚艾元提醒Drupal用户,及时升级安全补丁。


业务联系:崔克俊
手机: 13381113196
QQ: 372948992
公司电话:010-62669785

亚艾元象棋谱


亚艾元象棋谱,是亚艾元软件的一个实验项
目,以中国象棋棋谱为实例,用来探索最新
的Drupal网站开发、微信公众号开发、微信
公小程序开发、APP开发相关技术