This directory contains an example project that creates an Embedded Ch package including a header file and dynamic library. An executable program is also created that demonstrates the use of callback functions directly in C. A C# program is available in the Visual Studio solution file that demonstrates how to use the library. The dynamic library is designed to show how to interface an agent to a CLI language such as C#.

The package can be built at the command line or through Visual Studio. To build the package at the command line, run the following in this directory from a Ch shell:

make create

To install the package, run the command:

make install

The C example program can be found in src/. Run it using the commands:

cd src
./cs2ch

or

cd src
./cs2ch.exe

To build the library in Visual Studio, open the solution file in this directory, the right click the "cs2ch" project in the Solution Explorer. Select "Rebuild" to build the project. The project "LibMCInterop" demonstrates using the library from C# and allowing an agent to interact with C# and the library. To demonstrate this, do the following:

1. Right click "LibMCGui" and select "Set As Start-Up Project."
2. Start the program by pressing control-F5 or selecting "Debug->Start Without Debugging."
3. Start the agency by clicking the "Start Agency" button in the resulting form.
4. Return to Visual Studio and right-click the "LibMCInterop" project, then select "Debug->Start New Instance."
5. The program will run and show various calls to the library before stopping at the Mobile-C prompt.
6. Select the LibMCGui form and click the "Send Agent" button.
7. In the xml directory, select "dltest.xml" and click open.
8. The agent will travel to the LibMCInterop program. Once it has arrived and run to completion, the C# program will call three functions in the agent script to illustrate the correct ways to call different types of script functions.
9. Type "quit<enter>" in the LibMCInterop command window exit the program.

As previously mentioned, the purpose of this example is to create a dynamically loaded library that can be accessed by both agents and programs written in a CLI language. Once the package is installed, please refer to the example documentation for a more detailed discussion of the example program written in C# that demonstrates using the library. The library is located in the package installation directory, dl/ directory.
