Cbridge setup

Aus expecco Wiki (Version 2.x)
Zur Navigation springen Zur Suche springen

CBridge Setup[Bearbeiten]

In order to compile and execute C/C++ actions, a C compiler toolchain has to be installed on the machine, where the Bridge executable (Windows: cBridge.exe / Unix: cBridge) runs.
Typically this is the local machine on which expecco runs, but it may be any other machine in your reachable network.
The CPU architecture and or operating system may be (and often is) different from the CPU which executes expecco.

The C-code is compiled on the target machine (i.e. not cross-compiled).

C-Compiler Toolchain Installation[Bearbeiten]

Windows + Borland Compiler (32bit)[Bearbeiten]

The compiler is a bit outdated, but still free and useful. owever, it supports 32bit programs only. Thus, it cannot be used if you need access to 64bit dlls.
We recommend to install the toolchain at its default installation path (typically "C:\borland"). Then, the provided cc-compile script for borland can be used unchanged.

Windows + MINGW Compiler (32 or 64bit)[Bearbeiten]

The mingw toolchain is based on the gcc compiler. This is recommended and preferred over borland.

Windows + Microsoft Visual C / Visual Studio[Bearbeiten]

There is no need to install the full Visual Studio IDE. Only the C-compiler, linker and libraries are required. Thus, you can untoggle all additional optional packages during the installation.

Check for the "cl" command (being in your PATH) or find and remember the path to it (typically somewhere under "c:\Program Files\Microsoft\...").

Unix / Linux[Bearbeiten]

Install whatever packages are required; check if the "cc" command is found along your PATH (before starting expecco), or alternatively, remember the path to the "cc" command.

Regardless of which compiler you use, please remember the installation path. You will need it later unless the compiler is found along your PATH.

Quick Check if it already works[Bearbeiten]

We provide a number of setups for common installations. In many situations, this will already be correct for your setup.

To check, create a new elementary-bridgedC action, and run it. (the initial tree which is created with examples also contains a simple C action).

If you get a green OK result, you're already done. If not, your setup needs to be adjusted.

The compile script[Bearbeiten]

For compilation, the cBridge program calls a batch/shell script, which is responsible for compilation of the C-code to a DLL/shared object file. This script may need to be edited. We recommend, that you navigate to the folder where the cBridge executable is located, take one of the existing scripts as template, make a copy under a new name, and then edit this copy to suit your needs.

Take one of the existing scripts which uses the same compiler (borland/mingw/visualC).

In the editor, check the PATH setting, and edit it as appropriate, finally save it.

Back in expecco, go to the cBridge settings under the external-script settings, and change the CC-script setting there ("Extras" - "Settings" - "Execution" - "External Script Interpreters" - "CBridge").

Shutdown any already running bridge ("Extras" - "Debugging" - "Shutdown all Bridge Connections")

Go back to the C-action and repeat the quick check.

Eventually, you should see a green OK result.

Special additional Libraries[Bearbeiten]

It may be required that your C-code needs additional shared libraries to be linked against your code. The easiest is to add those libraries and corresponding command line options to the CC-script's compiler call command. The details depend on the compiler used. You may need to do a "cc --help", "cl/help" or similar, to figure out which command line options are required.

Remote C-Bridges[Bearbeiten]

You can run any number of cBridges on any machine within your network, and execute C-actions there. For this, the following setup steps are to be performed:

  • copy the cbridge executable and its support files to a new folder on the target machine; the files are found below the expecco installation folder
    (eg. "c:\Program Files\exept\expecco") in "packages\bridgeFramework\cBridge\cLibrary".
The easiest way is to copy the whole folder. Make sure that the copied folder matches the target machine's architecture (i.e. if the target is a Linux machine, you must obviously copy the files from a Linux installation, and same so for Windows machines).
  • on the remote machine, make sure that the cBridge is running; either by executing a remote command from inside your expecco suite, or by adding the cBridge startup to a cron tab (Unix/Linux) or the service list or autoexec.bat (Windows).
As a test, start it manually with: "cBridge --port 8856", and connect to it from expecco (change the settings ("Extras" - "Settings" - "Execution" - "External Script Interpreters" - "CBridge") to connect to an already running cBridge at that port).
  • if in doubt, start the cBridge with a "--help" option.

SSL Connection to the Remote CBridge[Bearbeiten]

You'll need certificate and key files to be generated on the expecco side and manually transport them to the target system. Details to be documented soon...



Copyright © 2014-2024 eXept Software AG