Hi all,<br><br>Is it possible to expand macros defined in includes into the .hsc file? I&#39;m trying to call functions from a library written in C. The library can be used with or without Unicode chars, depending on #define instructions.<br>
<br>The library has macros for all the standard functions used to work on strings (malloc, strlen, strcpy, strtok, ...). So that in code using the library one can always call the macro and don&#39;t care about the char type (strlenU instead of wcslen or strlen). Macro expansion will define which function will be used depending on the SAPwithUNICODE #define. I put a very simplified example below. The original file contains much more conditions (OS, Unicode or not, little or big endian, ...).<br>
<br>#define strlenU&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SAP_UNAME(strlen)<br><br>#ifdef SAPwithUNICODE<br>&nbsp; #define SAP_UNAME(name)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name##U16<br>#else<br>&nbsp; #define SAP_UNAME(name)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; name<br>#endif<br><br>#if defined(WCHAR_is_2B)<br>
&nbsp; #define strlenU16&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; wcslen<br>#endif<br><br>I would like to be able to expand strlenU in my .hsc file and get the correct function.<br><br>foreign import ccall &quot;static sapuc.h strlenU&quot;<br>&nbsp; f_strlenU :: Ptr (#type SAP_UC) -&gt; IO (#type size_t)<br>
<br>I would like to be able to expand the strlenU macro to the real function name (wcslen or strlen). Is there a way to do this?<br><br>Thanks,<br><br>Olivier.<br>