Skip to content

Commit a90aebb

Browse files
fix
1 parent e1dc6c2 commit a90aebb

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

CHANGES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Suppressed MinGW `-Wcast-function-type` on `GetProcAddress` cast in **cstring.core.c**;
1111
* Fixed MinGW `size_t` printf format in **example.c.cstring_create** (formerly **test.scratch.cstring_create**);
1212
* Moved scratch programs (except **libver**) into **examples/** as `example.c.*` / `example.cpp.*` with `main.c` / `main.cpp` and per-example **README.md**;
13-
* **example.cpp.cstring.dynload**: use `stlsoft::integer_to_decimal_string` with `static_cast<int>(rc)` (avoids MSVC C4996 and enum static-assert);
13+
* **example.cpp.cstring.dynload**: use `stlsoft::integer_to_decimal_string` with `static_cast<int>(rc)` (avoids MSVC C4996 and enum static-assert); replace `(FARPROC&)` punning with `reinterpret_cast` (MinGW `-Wstrict-aliasing`);
1414
* Added **prepare_cmake.sh** `--no-cpp` / CMake `NO_CSTRING_CPP_API`;
1515
* CI job for `--no-cpp` builds and unit-tests;
1616
* Converted unit-tests **test.unit.cstring.2**, **test.unit.cstring.auto_buffer**, and **test.unit.cstring.cstring_getStatusCodeString** from C++ to C (so they build under `NO_CSTRING_CPP_API`);

examples/cpp/example.cpp.cstring.dynload/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,9 @@ static int main_(int /* argc */, char ** /*argv*/)
107107
# pragma GCC diagnostic ignored "-Wcast-function-type"
108108
#endif /* __GNUC__ */
109109

110-
(FARPROC&)(_create) = ::GetProcAddress(hinst, "cstring_create");
111-
(FARPROC&)(_createEx) = ::GetProcAddress(hinst, "cstring_createEx");
112-
(FARPROC&)(_yield) = ::GetProcAddress(hinst, "cstring_yield");
110+
_create = reinterpret_cast<CSTRING_RC (*)(cstring_t*, char const*)>(::GetProcAddress(hinst, "cstring_create"));
111+
_createEx = reinterpret_cast<CSTRING_RC (*)(cstring_t*, char const*, size_t, void*, size_t)>(::GetProcAddress(hinst, "cstring_createEx"));
112+
_yield = reinterpret_cast<CSTRING_RC (*)(cstring_t*, char**)>(::GetProcAddress(hinst, "cstring_yield"));
113113

114114
#if defined(__GNUC__)
115115
# pragma GCC diagnostic pop

0 commit comments

Comments
 (0)