在 2022-11-01 23:38, xclae...@gmail.com 写道:
Thanks a lot for your help.

Sorry for late reply, but I gave your trick a try and it did not work:
```
/home/xclaesse/programmation/inline-example/builddir/../foo.h:7:
multiple definition of `g_strcmp0';
libfoo.dll.p/foo.c.obj:/home/xclaesse/programmation/inline-
example/builddir/../foo.h:7: first defined here
```


Apologies for the typo. The `__dllexport__` in 'foo.h' should have been `__gnu_inline__`. If, for some reason, it needs to be specified explicitly, you may do that in 'foo.c' instead.

'foo.h':
   ```
   #ifndef INSIDE_FOO_C
   __attribute__((__gnu_inline__)) __inline__
   #endif
   extern
   int g_strcmp0(const char*str1, const char*str2) {
     ...
   ```

'foo.c':
   ```
   __attribute__((__dllexport__)) /* This is optional.  */
   extern int g_strcmp0 (const char *str1, const char *str2);
   ```




--
Best regards,
LIU Hao

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to