Skip to content

Commit

Permalink
examples/usercmodule: Include API headers in the C++ example.
Browse files Browse the repository at this point in the history
Make the CI builds compile the public API as C++ to catch accidental
introductions of incompatible code.

Signed-off-by: stijn <stijn@ignitron.net>
  • Loading branch information
stinos committed Apr 24, 2024
1 parent 9c7f065 commit a65076a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions examples/usercmodule/cppexample/example.cpp
@@ -1,6 +1,22 @@
extern "C" {
#include <examplemodule.h>
// Include the public API. This is only here to verify everything compiles as C++,
// an actual application should only include what is needed.
#include <py/gc.h>
#include <py/obj.h>
#include <py/objarray.h>
#include <py/objexcept.h>
#include <py/objfun.h>
#include <py/objgenerator.h>
#include <py/objint.h>
#include <py/objlist.h>
#include <py/objmodule.h>
#include <py/objnamedtuple.h>
#include <py/objstr.h>
#include <py/objstringio.h>
#include <py/objtuple.h>
#include <py/objtype.h>
#include <py/runtime.h>

// Here we implement the function using C++ code, but since it's
// declaration has to be compatible with C everything goes in extern "C" scope.
Expand Down

0 comments on commit a65076a

Please sign in to comment.