This page describes an older version of the product. The latest stable version is 14.5.

Writing Existing Class to Space

This example shows you how to write your own c++ class to the space (as opposed to writing a class that is generated from a XML file). The code for this example is located at <XAP Root>\cpp\examples\PocoFromExistingClass\. This path will be referred to as <Example Root> in this page.

Note

This example can be built and run on Windows OS only. If you use Visual Studio open the solution PocoFromExistingClass.sln located in <XAP Root>\cpp\examples\PocoFromExistingClass\. It is recommended to set your solution configuration to Release and do a rebuild that will generate all related files.

The name of the class as returned by GetSpaceClassName should match the name of the class in the gs.xml file.
1. Make sure the class has a *default constructor**.
2. Optional – initialize with null values in the constructor:

Step 5. Handle the c++ serializer code generation, build the shared library (DLL) from this code, and place the library in the appropriate directory (<XAP Root>\lib\platform\native).
The following instructions show you how to do this in Visual Studio using the supplied makefile (<Example Root>/makefileSerializer.mk):