public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/53611] New: class with hidden visibility cause function returns pointer to class also be hidden
@ 2012-06-08 10:56 kirbyzhou@sogou-inc.com
  2012-06-08 11:16 ` [Bug c++/53611] " kirbyzhou@sogou-inc.com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: kirbyzhou@sogou-inc.com @ 2012-06-08 10:56 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53611

             Bug #: 53611
           Summary: class with hidden visibility cause function returns
                    pointer to class also be hidden
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: kirbyzhou@sogou-inc.com


[root@djt-17-109-v06 tmp]# cat tvisi.cpp

extern "C" typedef struct __cook cook_t;
extern "C" cook_t* myopen();

struct __attribute__ ((visibility ("hidden"))) __cook {
        virtual ~__cook() = 0;
};

//__attribute__ ((visibility ("default")))
cook_t* myopen()
{
        return 0;
}

[root@djt-17-109-v06 tmp]# g++ tvisi.cpp -o libxx.so -shared -fPIC && nm -D
libxx.so | fgrep myopen
00000000000005cc T myopen  

The function myopen is exported by g++ 4.4.6

[root@djt-17-109-v06 tmp]# g++47 tvisi.cpp -o libxx.so -shared -fPIC && nm -D
libxx.so | fgrep myopen
[root@djt-17-109-v06 tmp]# 

The function myopen is not exported by g++ 4.7.0

Workaround: define '__cook' after the definition of 'myopen'


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/53611] class with hidden visibility cause function returns pointer to class also be hidden
  2012-06-08 10:56 [Bug c++/53611] New: class with hidden visibility cause function returns pointer to class also be hidden kirbyzhou@sogou-inc.com
@ 2012-06-08 11:16 ` kirbyzhou@sogou-inc.com
  2012-06-08 18:44 ` pinskia at gcc dot gnu.org
  2012-06-09  9:43 ` kirbyzhou@sogou-inc.com
  2 siblings, 0 replies; 4+ messages in thread
From: kirbyzhou@sogou-inc.com @ 2012-06-08 11:16 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53611

--- Comment #1 from Kirby Zhou <kirbyzhou@sogou-inc.com> 2012-06-08 11:16:36 UTC ---
gcc source base:

DATE 20120604
svn://gcc.gnu.org/svn/gcc/branches/redhat/gcc-4_7-branch@188193


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/53611] class with hidden visibility cause function returns pointer to class also be hidden
  2012-06-08 10:56 [Bug c++/53611] New: class with hidden visibility cause function returns pointer to class also be hidden kirbyzhou@sogou-inc.com
  2012-06-08 11:16 ` [Bug c++/53611] " kirbyzhou@sogou-inc.com
@ 2012-06-08 18:44 ` pinskia at gcc dot gnu.org
  2012-06-09  9:43 ` kirbyzhou@sogou-inc.com
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-06-08 18:44 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53611

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-06-08 18:44:18 UTC ---
I think this is expected behavior as if someone defines a "__cook" in the
executable which links to the shared library, it will be considered a different
type.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/53611] class with hidden visibility cause function returns pointer to class also be hidden
  2012-06-08 10:56 [Bug c++/53611] New: class with hidden visibility cause function returns pointer to class also be hidden kirbyzhou@sogou-inc.com
  2012-06-08 11:16 ` [Bug c++/53611] " kirbyzhou@sogou-inc.com
  2012-06-08 18:44 ` pinskia at gcc dot gnu.org
@ 2012-06-09  9:43 ` kirbyzhou@sogou-inc.com
  2 siblings, 0 replies; 4+ messages in thread
From: kirbyzhou@sogou-inc.com @ 2012-06-09  9:43 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53611

--- Comment #3 from Kirby Zhou <kirbyzhou@sogou-inc.com> 2012-06-09 09:43:09 UTC ---
If "myopen" returns "__cook", I will agree with you. But "myopen" returns
"__cook *", just a pointer.
I do not think it is reasonable to hide "myopen".
It is a usual method to hide the implementation detail of cook_t, but exports 
some free function to operate with cook_t*, such as "FILE *".


(In reply to comment #2)
> I think this is expected behavior as if someone defines a "__cook" in the
> executable which links to the shared library, it will be considered a different
> type.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-06-09  9:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-08 10:56 [Bug c++/53611] New: class with hidden visibility cause function returns pointer to class also be hidden kirbyzhou@sogou-inc.com
2012-06-08 11:16 ` [Bug c++/53611] " kirbyzhou@sogou-inc.com
2012-06-08 18:44 ` pinskia at gcc dot gnu.org
2012-06-09  9:43 ` kirbyzhou@sogou-inc.com

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).