<p>I just got a question in my head, Since GoLANG is able to use C code inside itself... Would you be able to inject one processes into another native processes?</p>
<p>I know that people are using GoLANG for web applications more but i am interested in it for a general use.</p>
<hr/>**评论:**<br/><br/>TheMerovius: <pre><blockquote>
<p>Would you be able to inject one processes into another native processes?</p>
</blockquote>
<p>That question is not well-formed. What do you mean by "inject"? Processes exist as a hierarchy (at least in unix-like-ish OSes), one process can never be "part of" another process. If you mean "started by", there's <a href="http://godoc.org/os/exec" rel="nofollow">os/exec</a>. If you mean, you want to use the code of one program in another program, that's either cgo or what <a href="/u/nliadm" rel="nofollow">/u/nliadm</a> said.</p>
<p>But without some better phrasing of your question, it won't be possible to answer it properly.</p>
<p>PS: It's "go", not "golang", lest "GoLANG" :)</p></pre>SaturnsVoid: <pre><p>Guess these are terms not normally used... Take a look at this; <a href="http://www.adlice.com/runpe-hide-code-behind-legit-process/" rel="nofollow">http://www.adlice.com/runpe-hide-code-behind-legit-process/</a></p>
<p>Basically it injects a program into another process and runs it alongside, as one.</p></pre>TheMerovius: <pre><p>Okay, that's a different thing. You don't talk about processes, but about code (running code in a foreign process). And yes, with the mechanism hinted at by <a href="/u/nliadm" rel="nofollow">/u/nliadm</a> this is possible (basically, all you need for that is dynamically loadable code. As of go 1.5, the gc toolchain can create that).</p></pre>scottjbarr: <pre><p>Go is great for general use. I write all kinds of apps with it.</p>
<p>It sounds to me like you're wanting to write an application that uses a an existing library?</p></pre>nliadm: <pre><p><code>go help buildmode</code> explains some ways external programs can call go code.</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传