delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/04/23/08:13:58

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Message-ID: <0f1a01be8d82$a7514a60$e63d2509@jonpryor.raleigh.ibm.com>
From: "Jonathan Pryor" <jonpryor AT vt DOT edu>
To: <cygwin AT sourceware DOT cygnus DOT com>
Subject: Re: CoInitialize(NULL)?
Date: Fri, 23 Apr 1999 08:12:39 -0400
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 4.72.3110.5
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3

CoInitialize is a C function, so there shouldn't be any problems
linking to it.

Where there any warnings during compilation?

For example, given the following program:

    #include <windows.h>
    int main (int, char **) {
        CoInitialize (NULL);
        CoUninitialize ();
        return 0;
    }

I get the following warnings using the headers included with B20.1:

    warning: implicit declaration of function `int CoInitialize(...)'
    warning: implicit declaration of function `int CoUninitialize(...)'

This is the cause of your problem -- the function prototype is 
incorrect (because there isn't one).  They should be:

    extern "C" long __attribute__((stdcall)) CoInitialize (void*);
    extern "C" void __attribute__((stdcall)) CoUninitialize (void);

I would suggest that you download Anders Norlander's header files
and use those instead, as they support most of the Win32 API.
They're available at:

    http://www.acc.umu.se/~anorland/gnu-win32/w32api.html

However, I should warn you that if you plan to use cygwin for COM
development, you'll need to stick with C for now, as the egcs 
C++ v-table layout is currently incompatible with COM.  This may
be fixed in a future release of egcs.

 - Jon

-----Original Message-----
From: Eugene Kanter <eugene AT bgs DOT com>
To: cygwin AT sourceware DOT cygnus DOT com <cygwin AT sourceware DOT cygnus DOT com>
Date: Thursday, April 22, 1999 7:18 PM
Subject: CoInitialize(NULL)?


>I can not call the function listed in subject. Linker fails. The
>function is in ole32.dll. I do use -lole32 switch.
>
>Could it be a C++ function?
>
>Are there any workaround like compile a static library with the C
>wrapper function using MSVC++ and then link to it using gcc?
>
>Eugene.
>
>--
>Want to unsubscribe from this list?
>Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com
>


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


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