diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2021-07-28 16:53:41 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2021-07-28 18:27:51 +0200 |
commit | 6c602fd542b7f97e3a23ef27c3839656906c98de (patch) | |
tree | 31ca34bd5ed53a52ae3181878b9ebbe9c92b15f8 /ddk-template-cplusplus.cpp | |
parent | 3a3cbeecc113daf992de838a39569f6c81876dbe (diff) |
Fixed ctor/dtor issue allowing use of static qualifiers for non primitives.
* split CRT in a C and C++ part
* use "fake" entry point to init CRT and set a DriverUnload routine for de-init
* added -Wl,--exclude-all-symbols to DRIVER_LDFLAGS
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'ddk-template-cplusplus.cpp')
-rw-r--r-- | ddk-template-cplusplus.cpp | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/ddk-template-cplusplus.cpp b/ddk-template-cplusplus.cpp index 380603a..f9167ec 100644 --- a/ddk-template-cplusplus.cpp +++ b/ddk-template-cplusplus.cpp @@ -35,6 +35,29 @@ public: } }; +class DerivedWithCDtor : public Derived +{ +public: + explicit DerivedWithCDtor(unsigned int value) + { + some_value = value; + DbgPrint("%s\n", "DerivedWithCDtor-Ctor."); + } + ~DerivedWithCDtor() + { + DbgPrint("%s\n", "DerivedWithCDtor-Dtor."); + } + void doSmth(void) + { + DbgPrint("SomeValue: %X\n", some_value); + } + +private: + unsigned int some_value = 0; +}; + +static DerivedWithCDtor some_static(0xDEADC0DE); + struct threadContext { DriverThread::Semaphore sem; @@ -70,6 +93,8 @@ static void test_cplusplus(void) ctx.dth.WaitForTermination(); ctx.dth.WaitForTermination(); DbgPrint("MainThread EOF\n"); + + some_static.doSmth(); } extern "C" @@ -86,9 +111,6 @@ extern "C" DbgPrint("%s\n", "Hello ring0!"); cdtor_test = new TestSmth(); - /* support for service stopping */ - DriverObject->DriverUnload = DriverUnload; - test_cplusplus(); return STATUS_SUCCESS; |