Search code examples
c++apache-flexprogramming-languagescross-language

Flex -- C++ connection?


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 ?


Solution

  • 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.