Issue with dllexport/dllimport inline function
LIU Hao
lh_mouse@126.com
Wed Oct 12 03:03:35 GMT 2022
在 2022/10/12 02:37, xclaesse@gmail.com 写道:
>
> Build it with:
> meson setup builddir --cross-file cross_file_mingw64.txt
> ninja -C builddir/
>
> And it fails with:
That's because you compiled it as C. I used g++ to compile these, and there was no such error.
For C, this inline issue is going to be much more messy due to lack of COMDAT support about
`inline`. Your will need a dedicated macro for each translation unit. A dirty solution looks like this:
```
#ifndef INSIDE_FOO_C
__attribute__((__dllexport__)) inline
#endif
extern
int
g_strcmp0(const char*str1, const char*str2)
...
```
and in 'foo.c':
```
#define INSIDE_FOO_C 1
#include "foo.h"
extern int g_strcmp0 (const char *str1, const char *str2);
```
Further reading:
https://github.com/lhmouse/mcfgthread/wiki/Differences-between-GNU,-C99-and-C---%60inline%60
--
Best regards,
LIU Hao
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20221012/b283c6cc/attachment.sig>
More information about the Gcc
mailing list