Re: Issue with dllexport/dllimport inline function

2022-11-01 Thread Xavier Claessens via Gcc
Oh, that seems to be working now. Still got a small issue, glib compiles with -Werror=missing- prototypes:  ../foo.h:7:5: error: no previous prototype for ‘g_strcmp0’ [- Werror=missing-prototypes] I'm a bit lost with what the prototype would look like in this case. I think `__attribute__((__dll

Re: Issue with dllexport/dllimport inline function

2022-11-01 Thread Xavier Claessens via Gcc
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

Re: Issue with dllexport/dllimport inline function

2022-10-11 Thread Xavier Claessens via Gcc
Le mercredi 12 octobre 2022 à 01:42 +0800, LIU Hao a écrit : > 在 2022-10-11 22:26, xclae...@gmail.com 写道: > > #ifdef GLIB_COMPILATION > > #  define _GLIB_API _GLIB_EXPORT > > #  define GLIB_INLINE __attribute__((__dllexport__)) > > __attribute__((__gnu_inline__)) extern inline > > This is not corr

Re: Issue with dllexport/dllimport inline function

2022-10-11 Thread Xavier Claessens via Gcc
Le mardi 11 octobre 2022 à 21:35 +0800, LIU Hao a écrit : > 在 2022/10/11 21:28, LIU Hao via Gcc 写道: > > > > Did you have any declarations that had no `__gnu_inline__`? GNU > > inline functions are supposed to be > > emitted out of line, even when its address is taken. > > > > This should be 'to

Re: Issue with dllexport/dllimport inline function

2022-10-11 Thread Xavier Claessens via Gcc
Le mardi 11 octobre 2022 à 13:00 +0800, LIU Hao a écrit : > you may try > >    ``` >    __attribute__((__gnu_inline__)) >    extern inline >    int g_strcmp0(const char*, const char*) > { ... >    ``` Thanks, I gave that a try but I get many: multiple definition of `g_strcmp0'. But at least

Issue with dllexport/dllimport inline function

2022-10-11 Thread Xavier Claessens via Gcc
Hi, I'm trying to dllexport/dllimport an inline function, but I get this warning: ``` inline function ‘g_strcmp0’ declared as dllimport: attribute ignored [- Wattributes] ``` This is when cross compiling my code on Linux for Windows using mingw. The relevant code is ``` GLIB_API inline int

Issue with dllexport/dllimport inline function

2022-10-10 Thread Xavier Claessens via Gcc
Hi, I'm trying to dllexport/dllimport an inline function, but I get this warning: ``` inline function ‘g_strcmp0’ declared as dllimport: attribute ignored [- Wattributes] ``` This is when cross compiling my code on Linux for Windows using mingw. The relevant code is ``` GLIB_API inline int