This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project. See the Cygwin home page for more information.
Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: CoInitialize(NULL)?


After using Anders Norlander's header files everything is working
perfectly. It turned out that correct ole32.a has alredy been present in
cygwin lib directory.

Is there be an update of cygwin windows related header files to be as
complete as Anders Norlander's?

Eugene.

Jonathan Pryor wrote:
> 
> 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@bgs.com>
> To: cygwin@sourceware.cygnus.com <cygwin@sourceware.cygnus.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@sourceware.cygnus.com
> >
> 
> --
> Want to unsubscribe from this list?
> Send a message to cygwin-unsubscribe@sourceware.cygnus.com

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com