From 25c4563f26c2270cde01b01dca0e8b801c9c8282 Mon Sep 17 00:00:00 2001 From: stijn Date: Wed, 21 Oct 2020 11:13:47 +0200 Subject: examples: Add example code for user C modules, both C and C++. Add working example code to provide a starting point for users with files that they can just copy, and include the modules in the coverage test to verify the complete user C module build functionality. The cexample module uses the code originally found in cmodules.rst, which has been updated to reflect this and partially rewritten with more complete information. --- tests/unix/extra_coverage.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests/unix/extra_coverage.py') diff --git a/tests/unix/extra_coverage.py b/tests/unix/extra_coverage.py index 1c028506e..b4808993a 100644 --- a/tests/unix/extra_coverage.py +++ b/tests/unix/extra_coverage.py @@ -49,6 +49,16 @@ print(buf.write(bytearray(16))) # function defined in C++ code print("cpp", extra_cpp_coverage()) +# test user C module +import cexample + +print(cexample.add_ints(3, 2)) + +# test user C module mixed with C++ code +import cppexample + +print(cppexample.cppfunc(1, 2)) + # test basic import of frozen scripts import frzstr1 -- cgit v1.2.3