Subject: OLE 2.0 and G++ (fwd)
From: [email-masked] (Eric Britten)

11 Apr 1997 17:31:06 -0700
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Original-To: [email-masked]
Original-Sender: [email-masked]

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 in a generic file called file.cpp:

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 BarPtr() 
-or-
void __stdcall * BarPtr()
?

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 (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".