[Haskell-cafe] Re: Re[2]: Cabal, GHC, FFI and Visual Studio on Windows

Magnus Therning magnus at therning.org
Mon Feb 4 04:47:38 EST 2008


Aaron Denney wrote:
> On 2008-02-03, Bulat Ziganshin <bulat.ziganshin at gmail.com> wrote:
>> Hello Duncan,
>>
>> Sunday, February 3, 2008, 5:24:22 AM, you wrote:
>>
>>> Ok, so you could create a separate component to produce the .dll / .a
>>> from the C code but you'd prefer the convenience of being able to just:
>>> c-sources: blah.c
>>> and have them included in the project, but built using the MS C
>>> compiler.
>>> So I think we should file a feature request about building C sources
>>> using gcc/ms-c directly rather than going via ghc as that would give us
>>> the flexibility to use alternative C compilers.
>> sorry, i think it's not whole story. gcc and msvc are probably
>> incompatible in the meaning that you can't link together code
>> produced by two compilers. exactly dll should be generated which allow
>> to avoids this incompatibility
> 
> Well, the whole purpose of the ABI is to allow linking code together
> from different compilers.  This doesn't mean there won't be any problems,
> but I'd expect the ones that crop up won't *strictly* be because of
> the compilers being different, but because of the C libraries being
> different.  DLL vs object files shouldn't change things all that much.

Well, I can at least report that linking a library (.lib) produced using
cl (via CMake) with object files created by GHC works well.  I do get a
warning:

 Warning: .drectve `/manifestdependency:"type='win32'
name='Microsoft.VC90.CRT' version='9.0.21022.8'
processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b'"
/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"MSVCRT"
/DEFAULTLIB:"OLDNAMES" ' unrecognized

But it doesn't seem to have any impact on the resulting executable.

/M

-- 
Magnus Therning                             (OpenPGP: 0xAB4DFBA4)
magnus@therning.org             Jabber: magnus.therning@gmail.com
http://therning.org/magnus

What if I don't want to obey the laws? Do they throw me in jail with
the other bad monads?
     -- Daveman

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20080204/4f36e408/signature.bin


More information about the Haskell-Cafe mailing list