柔性——C++联系?
如何将 Flex 应用程序(互联网站点)和 C++ 连接在一起?
我的意思是一个简约的例子(用户故事): Frank 访问 www.myflexsite.de,那里有 2 个文本框和 1 个按钮(标签 = 添加两个数字)。 他在第一个文本框中插入 2,在第二个文本框中插入 5。现在他单击添加按钮。
后端:我们有一个 add.cpp 文件,其中定义了 add 方法:
int add(int a, int b ) ...
Frank 单击“添加两个数字”按钮后,将调用 C++ 文件中的 add 方法并返回结果。一个警报窗口,其中包含结果出现。
这就是我想要实现的目标,但我不知道如何在这两种语言之间建立桥梁。 他们如何沟通?
How do I connect a Flex Application( Internet Site ) and C++ togehter ?
a minimalistic example from what i mean (User Story):
Frank goes to www.myflexsite.de there are 2 textboxes and 1 Button( Label = add two numbers) .
He inserts 2 in the first textbox and 5 in the ohter. Now he clicks on the add button.
The Backend : We have a add.cpp file where an add method is defined :
int add(int a, int b ) ...
After Frank clicked on the "add two numbers" Button the add-method in the C++ file is called and the result will be returned.An Alert Window with the result appears.
This is what i want to accomplish, but i don't know how i build the bridge between these 2 Languages.
How can they communicate ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
最简单的方法是用 C++ 编写一个小型控制台应用程序,然后通过 Apache 或任何其他使用 CGI 的 Web 服务器调用它。这会带来性能问题,但这是一个好的开始,然后您就可以继续前进。 Flex 只需发出 HTTP 请求并让您的程序解析它们 - 例如,您可以来回发送 XML。
The easiest would be to write a small console application in C++ and then invoke it via Apache or any other web server using CGI. There are performance problems with this but it's a good start, and then you can move forward. From Flex just make HTTP requests and let your program parse them - for instance, you can send XML back and forth.
我认为这不一定是意图,但根据您想要完成的任务,您可能需要看看 Alchemy 项目 - http://labs.adobe.com/technologies/alchemy/ 您可以使用它将 C++ 代码编译为在 Flash Player 上运行的代码。
这不会帮助您在客户端和服务器之间进行通信,但如果您不想完全重写某些代码,直接在 Flash 中公开可能会更有帮助,那么这可能是一个解决方案。
=Ryan [电子邮件受保护]
I don't think this is necessarily the intent, but depending on what you want to accomplish you may want to take a look at the Alchemy project - http://labs.adobe.com/technologies/alchemy/ you can use it to compile C++ code down into code that runs on the Flash Player.
This won't help you communicate between a client and a server, but if there is code you don't want to have to completely rewrite that might be more helpful exposed directly in Flash, this could be a solution.
=Ryan [email protected]
我本来打算写一个“Restful”示例,但是 Bing 快速搜索发现这个人已经做到了:
雅虎!图像搜索 REST API - Flex 示例
只需使用您喜欢的任何语言编写您自己的服务器端 Web API。
预计到达时间:问题 153420 也可能有帮助。
I was going to write a 'Restful' example, but a quick Bing search finds this guy has already done it:
Yahoo! Image Search REST API - Flex example
Just write your own server side web api in whatever language floats your boat.
ETA: question 153420 might be helpful also.