delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/04/07/13:51:10

From: ebritten AT ea DOT oac DOT uci DOT edu (Eric Britten)
Subject: OLE 2.0 and G++
7 Apr 1997 13:51:10 -0700 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <Pine.GSO.3.95.970407122321.15042B-100000.cygnus.gnu-win32@rigel.oac.uci.edu>
Mime-Version: 1.0
Original-To: cygnus <gnu-win32 AT cygnus DOT com>
In-Reply-To: <199704061544.IAA01179@nz1.netzone.com>
Original-Sender: owner-gnu-win32 AT cygnus DOT com

I was trying to compile a shell extension example from microsoft and ran
into a few problems.  I recieved errors and warnings that I did not like.
I am using the headers provided by the Platform SDK from Microsoft.

The shell extensions used C++ classes, not the C structures.

The warnings that bothered me came from the virtual member functions of
all the Interfaces in the ole 2.0 headers.

For example, an interface:

class IFoo
{
public:
  void __stdcall Bar() = 0;		//4
  void * __stdcall BarPtr() = 0;  	//5
};

On line 4 I would receive a warning like:

file.cpp:4: warning:  attribute directive ignored

I know that __stdcall expands to __attribute__((stdcall)).  All OLE
functions and interfaces use the __stdcall convention.  I am worried that
since the attribute directive is ignored that the __stdcall convention
will be ignored, and the __cdecl convention will be used instead.  I doubt
that the two conventions are compatible.  Can Class member functions be
__stdcall.  I determined that the fact that the function is pure virtual
is not relavent.

The errors that I received were something like
file.cpp:5: syntax error before __attribute__.  Using trial and error I
found that if the pointer '*' is placed after the __stdcall then there is
no error.  Why would it make a difference if the function had:

void * __stdcall
-or-
void __stdcall *
?

There is a chance that I have this reversed, I can't check right now.
 
And lastly is it possible to export a C++ class, its member data, or its
member functions from a dll?  It it possible to export a function that is
in a c++ module that is not 'extern "C"'?


Eric Britten
------------------------------------------------------
------------------------------------------------------

-
For help on using this list, send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019