Re: Issue with dllexport/dllimport inline function

2022-11-01 Thread LIU Hao via Gcc
在 2022/11/2 02:11, xclae...@gmail.com 写道: 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 i

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 LIU Hao via Gcc
在 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/programmati

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 LIU Hao via Gcc
在 2022/10/12 02:37, xclae...@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

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 LIU Hao via Gcc
在 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 correct. Typically, `dllexport` indicates that 'I want an external definition' but

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 LIU Hao via Gcc
在 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 be never emitted out of line'. Sorry for that. -- Best regards, LIU Hao Ope

Re: Issue with dllexport/dllimport inline function

2022-10-11 Thread LIU Hao via Gcc
在 2022/10/11 21:10, xclae...@gmail.com 写道: 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 def

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

Re: Issue with dllexport/dllimport inline function

2022-10-10 Thread LIU Hao via Gcc
在 2022/10/11 00:39, Xavier Claessens via Gcc 写道: Is there a trick to get that working with GCC? Or should that issue be reported somewhere? Probably. This Microsoft `dllimport` with `inline` has the same semantics with GNU `extern inline`, so may be it's an alternative. So instead of `

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