cpgf -- open source C++ library for callback, reflection, script binding
cpgf documentation download change log support

cpgf library -- a free C++ open source library for reflection, script binding, callbacks

cpgf is a free, open source and cross platform C++ library.
cpgf is composed by several independent components:
The goal of cpgf is to extend C++ language with a lot of easy to use features which are only available in other higher level languages and absence in C++.
cpgf provides a very easy to use callback system, which is common used in C# and script languages.
cpgf provides a powerful reflection and meta data system. Ever envy the reflection system in C# and Java? now we have it in C++!
cpgf makes binding Lua and Google V8 to C++ a piece of cake! The script binding engine uses the reflection system extensively.
Want to use OpenGL in Lua and Javascrit? It can't be easier using cpgf.

Vesion 1.2.5 is released on Feb.5, 2012.

Key features

Quick facts of reflection library

Quick facts of script binding library

Download cpgf library

Download the library

Documentations

Read the documentations

License

Apache License, Version 2.0

Library version

1.2.5

Change log

Change log

Author and owner

Wang Qi, in Beijing, China
Website: http://www.kbasm.com/

Compatibility -- Tested compilers and platforms

Support GCC 3.4.2 and up, MS VC 2008 and up, C++ Builder 2010 and up, XCode and Intel C++ Compiler.
Read this document for more information

Required third party library -- None for the primary libraries

Doesn't require C++0X, TR1 or C++11 features.
Doesn't require Boost library.
For Lua binding, Lua library is required.
For Google V8 Javascript binding, V8 library is required.
If you want to run the unit test, UnitTest++ is required. But usually you don't need to do that.

Learning the library

Though there are some documentations on this website, they are far from good.
They are incomplete, and not quite native reading.

The fastest way to get start with the library is to read the sample code in the folder "samples".
The sample code was originally written for test purpose, so they are not as easy to read as you expect. But they covers most features so it's a good kick off.

If you want to read more sample code, read the code in the folder "test".
They are for unit test. They are much more difficult to read and they use a lot of macros.
However, they cover much more functions than the sample code.

How is the library tested

Several measures are adopted to test the library.
Unit test -- hundreds of unit tests were written and ran. More unit tests are being added for existing code and new code.
Valgrind -- valgrind is used to check memory leaks and other memory problems (wild pointer, double free, etc).
Code coverage -- GNU gcov is used to check the code coverage in unit tests. The ultimate goal is to cover all API functions and 80% implementation code. Though we didn't achieve the goal yet, we are closing to it day by day.

Contribute to the library

If you like the library and want to contribute to it, here are some most desired work to do
1, Use the library in your real project. That will help the library much. A library is nothing without real projects using it.
2, Help with the documentation. I'm not a native English speaker, and I also don't enjoy writing documentation.
3, Test the library on more compilers and platforms, especially on 64 bit platforms and compilers.

What does cpgf mean?

The original cpgf means Cross Platform Game Framework.
It was intended to be game framework that can work on PC and smart phone.
But later I decided to add more fun but non-game features to the library.
So now the library is neither for game nor a framework.
It's a cross platform C++ library.

Write a comment

  • Required fields are marked with *
  • Security Code is case sensitive, 'A' is different with 'a'.

If you have trouble reading the code, click on the code itself to generate a new random code.
Security Code: