This is a wrapped version of the Listen example, that works in the C environment.
Creating a C Interface
First a C language interface is created. No classes or other C++ concepts are exported.
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
Sample C-Interface Program
Here is a C language program that uses the C Language interface.
#include <stdio.h>
int main(int argc, char *argv[])
{
double *firstPos;
while (1)
{
if (firstPos)
{
printf("Position of first entity: %.1f %.1f %.1f\n",
firstPos[0], firstPos[1], firstPos[2]);
}
}
return 0;
}
{
printf("Fire Pdu from %s\n", attacker);
}
Interface Wrapper Code
We write the wrapper code in C++ inside the interface.
{
appInit.parseCmdLine();
}
{
}
{
if (first)
{
}
return NULL;
}
{
}