Using C++ in modules

It is possible to implement modules in C++. The main difference between using C++ and C is that you have to define all your implementation functions as extern "C" and, of course, use a C++ compiler such as g++ to compile and link the module.

All the instructions in section Using standard C libraries in modules apply as well.

Here is a simple C++ example module:

#include <alore/alore.h>

extern "C" AValue Greeting(AThread *t, AValue *frame)
{
    return AMakeStr(t, "hello, world");
}

A_MODULE(hellocpp, "hellocpp")
    A_DEF("Greeting", 0, 0, Greeting)
A_END_MODULE()

Note: Implementing C++ modules has not received much testing and this section does not mention many potential issues.