From: xclaesse@gmail.com
To: LIU Hao <lh_mouse@126.com>, gcc@gcc.gnu.org
Subject: Re: Issue with dllexport/dllimport inline function
Date: Tue, 01 Nov 2022 14:11:43 -0400 [thread overview]
Message-ID: <c983a7387c3bd0736ef12161669bca3619bc53f5.camel@gmail.com> (raw)
In-Reply-To: <f566ee4c-d552-7014-827e-d9baebd8b986@126.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 in this case.
I think `__attribute__((__dllexport__))` will be needed when building
with MSVC at least. Seems gcc, clang and msvc each wants a different
trick :/
Thanks,
Xavier Claessens.
Le mercredi 02 novembre 2022 à 00:06 +0800, LIU Hao a écrit :
> 在 2022-11-01 23:38, xclaesse@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
>
next prev parent reply other threads:[~2022-11-01 18:11 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-10 16:39 xclaesse
2022-10-11 5:00 ` LIU Hao
2022-10-11 13:10 ` xclaesse
2022-10-11 13:28 ` LIU Hao
2022-10-11 13:35 ` LIU Hao
2022-10-11 14:26 ` xclaesse
2022-10-11 17:42 ` LIU Hao
2022-10-11 18:37 ` xclaesse
2022-10-12 3:03 ` LIU Hao
2022-11-01 15:38 ` xclaesse
2022-11-01 16:06 ` LIU Hao
2022-11-01 18:11 ` xclaesse [this message]
2022-11-02 4:44 ` LIU Hao
-- strict thread matches above, loose matches on Subject: below --
2022-10-10 16:32 xclaesse
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c983a7387c3bd0736ef12161669bca3619bc53f5.camel@gmail.com \
--to=xclaesse@gmail.com \
--cc=gcc@gcc.gnu.org \
--cc=lh_mouse@126.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).