Has anyone tried linking our DLLs and MS Visual Studio code?

Daniel P. Berrange berrange at redhat.com
Thu Dec 11 19:20:00 UTC 2008


On Thu, Dec 11, 2008 at 07:22:13PM +0100, Erik van Pienbroek wrote:
> Op donderdag 11-12-2008 om 17:45 uur [tijdzone +0000], schreef Richard
> W.M. Jones:
> > The question was raised today as to whether it really works.
> > 
> > We expect that C will work.  We (Red Hat) haven't actually tried the
> > combination of our DLLs and MS VC-compiled C code.
> > 
> > We expect / are almost certain that C++ won't work.  C++ code may link
> > and fail in creative ways, such as exceptions disappearing, or maybe
> > it just won't link at all.
> > 
> > Rich.
> > 
> 
> Hi,
> 
> I haven't tried cross-compiling anything with the MinGW GCC of Fedora
> yet, but I do have tried to call MinGW compiled DLL's (build on a Vista
> host) from Visual Studio 2005 and 2008 applications (both plain C code).
> 
> Mixing MinGW produced DLL's with Visual Studio applications works, but
> there are some caveats to it. The most annoying thing is that file
> pointers aren't exchangeable between MinGW and Visual Studio. Normally
> this isn't a problem, but for example with GLib, there's a function to
> open a file (g_open, which returns a file pointer), but there are no
> functions to read/write data to it making it practically useless in a
> mixed environment. 

Isn't this taken care of with Microsoft's OSF conversion routines

 http://msdn.microsoft.com/en-us/library/bdts1c9x(VS.71).aspx
 http://msdn.microsoft.com/en-us/library/ks2530z6.aspx

Specifically _open_osfhandle() and _get_osfhandle() which allow you to
convert between a UNIX style 'int fd' and a Win32 HANDLE in both
directions. This is what GNULIB uses to make WinSock comply with proper
POSIX api contracts.

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|



More information about the mingw mailing list