Ron Pinkas wrote:
Enrico Maria Giordano wrote:
Il 19/12/2023 19:13, Enrico Maria Giordano ha scritto:
2023-12-19 19:12 UTC+0100 Enrico Maria Giordano <[email protected]>
� * contrib\hbhpdf
��� ! Reverted my recent changes
OK, now I get many of these errors using MSC32:
contrib\hbhpdf\hpdf_objects.c(60): error C2664: 'void HPDF_String_Free(HPDF_String)': cannot convert argument 1 from 'void *'
to 'HPDF_String'
contrib\hbhpdf\hpdf_objects.c(60): note: Conversion from 'void*' to
pointer to non-'void' requires an explicit cast
Please note that they are errors, not warnings. What to do, other than fixing them?
Enbrico,
Can you please provide all of them?
One approahc we may consider is:
-D'HPDF_String_Free(arg)=HPDF_String_Free((HPDF_String)(arg))'
On the command line in the make for given compiler.
Another approach is to FORK libharu and make the fixes in our fork, and
later we may MERGE future modifications of libharu into our fork.
Or BEST we may open an issue on GitHub, and report such errors and
propose the fix ass a PULL REQUEST.
What do you think?
Ron
Ron
One more approach is to ADD one more source file (xhb_config.c) like
this:
------ xhb_config.c ------
#ifdef __cplusplus
extern "C" {
#endif
// Original function declaration (if not already declared)
void HPDF_String_Free(HPDF_String arg);
#ifdef __cplusplus
}
// Overloaded function for C++
void HPDF_String_Free(void* arg) {
HPDF_String_Free(static_cast<HPDF_String>(arg));
}
#endif
------ EOF xhb_config.c ------
AND one header (xhb_config.h) like this:
----- xhb_config.h -----
#ifndef XHB_CONFIG_H
#define XHB_CONFIG_H
#ifdef __cplusplus
extern "C" {
#endif
// Direct declaration of the original HPDF_String_Free function
// Replace the return type and parameters as per the actual function signature void HPDF_String_Free(HPDF_String arg);
#ifdef __cplusplus
}
// C++ overload for HPDF_String_Free
void HPDF_String_Free(void* arg) {
HPDF_String_Free(static_cast<HPDF_String>(arg));
}
#endif // __cplusplus
#endif // XHB_CONFIG_H
----- EOF xhb_config.h -----
Then we add xhb_config.c to make files of C++ compilers like MSC and we
also add automatic inclusion of xhb_config.h
(for MSC add flag: /FI"xhb_config.h")
This approach uses C++ funcion overloading to automaically directs calls
with void * to overloaded wrapper which then add the cast and call the
real function (NO R/TT overhead).
Do you know which make file is used for MSVC - this approach can quickly
be impllemented and is a safe approach.
Ron
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)