Re: ghc and gcc-4
Here's the error message (i386, ghc-6.4, gcc-4.0.? (as in SuSE 10.0)) *** Mangler /usr/local/lib/ghc-6.4/ghc-asm /tmp/ghc14976.raw_s /tmp/ghc14976.s 4 Warning: retaining unknown function `__i686.get_pc_thunk.bx' in output from C compiler Prologue junk?: .globl Mysqlconnect_lvl_entry .type Mysqlconnect_lvl_entry, @function Mysqlconnect_lvl_entry: .LFB147: .file 1 /tmp/ghc14976.hc .loc 1 17 0 .LVL0: .LCFI0: .LVL1: .LCFI1: .LVL2: call__i686.get_pc_thunk.bx addl$_GLOBAL_OFFSET_TABLE_, %ebx .loc 1 18 0 There may well be problems, yes. Have you tried 6.4.1? Or a STABLE snapshot? no, will do. -- -- Johannes Waldmann -- Tel/Fax (0341) 3076 6479/80 -- http://www.imn.htwk-leipzig.de/~waldmann/ --- ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: Linking with C++ produced by Visual Studio .NET on Windows XP?
I am far from being an expert, but I have seen no answer to your question so far, so I'll tell how I'd do it (however ugly that might be). I don't have a sample project, but it should be fairly easy to make it. 1. Make a DLL project in Visual Studio. VS will create a .vcproj and .sln files for you. Add your C++ source files to this project. 2. Create a .def file for your DLL. It might look like LIBRARY MyDLL EXPORTS function1 function2 where function1 and function2 are the names of the C++ functions that you want to invoke from Haskell (there can be more of them, of course), MyDLL is the name of your DLL. 3. Create an import library that can be used by ghc: dlltool -d MyDLL.def -l libMyDLL.a where MyDLL.def is the name of the .def file, libMyDLL.a is the import library. 4. Link your Haskell project, adding the library: ghc --make main.hs -optl-lMyDLL -optl-L. (-optl switch passes its argument as an option to the linker). Hope this helps. Cheers, Cyril ___ Hi - I'm wondering if anyone has a simple Visual Studio .NET C++ project that would demonstrate how to link C++ with Haskell (or vice versa). Ie a .sln, .vcproj, .cpp, and .h file containing one C++ function and a Haskell file main.hs that calls this function, so that if I click on the .sln file and hit F6 the VS project will build then on the command line if I type ghc --make main.hs the Haskell program will be built so that when I type main on the command line it will run and call the C++ function. Sorry if this all sounds too basic but I don't know how to compile C++ from the command line at all or how to use make files, and I need to use the Visual Studio compiler because my own C++ code relies on Microsoft extensions... Thanks, Brian. ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
RE: Linking with C++ produced by Visual Studio .NET on Windows XP?
GHC now makes it easy for all users to contribute new documentation about GHC to help other users, by adding to the GHC documentation wiki. See the Collaborative documentation heading on http://haskell.org/haskellwiki/GHC:Documentation Linking to C++ would be an ideal topic. It's a regular question, and not one of our strengths at GHC HQ! Simon | -Original Message- | From: [EMAIL PROTECTED] [mailto:glasgow-haskell-users- | [EMAIL PROTECTED] On Behalf Of Cyril Schmidt | Sent: 23 January 2006 09:57 | To: glasgow-haskell-users@haskell.org | Subject: Re: Linking with C++ produced by Visual Studio .NET on Windows XP? | | I am far from being an expert, but I have seen no answer to your question | so far, so I'll tell how I'd do it (however ugly that might be). I don't | have a sample project, but it should be fairly easy to make it. | | 1. Make a DLL project in Visual Studio. VS will create a .vcproj and | .sln files for you. Add your C++ source files to this project. | | 2. Create a .def file for your DLL. It might look like | LIBRARY MyDLL | EXPORTS | function1 | function2 | | where function1 and function2 are the names of the C++ functions that | you want to invoke from Haskell (there can be more of them, of course), | MyDLL is the name of your DLL. | | 3. Create an import library that can be used by ghc: | dlltool -d MyDLL.def -l libMyDLL.a | | where MyDLL.def is the name of the .def file, libMyDLL.a is the import | library. | | 4. Link your Haskell project, adding the library: | ghc --make main.hs -optl-lMyDLL -optl-L. | (-optl switch passes its argument as an option to the linker). | | Hope this helps. | | Cheers, | | Cyril | | ___ | | Hi - | I'm wondering if anyone has a simple Visual Studio .NET C++ project that | would demonstrate how to link C++ with Haskell (or vice versa). Ie a .sln, | .vcproj, .cpp, and .h file containing one C++ function and a Haskell file | main.hs that calls this function, so that if I click on the .sln file and | hit F6 the VS project will build then on the command line if I type | ghc --make main.hs the Haskell program will be built so that when I type | main on the command line it will run and call the C++ function. | | Sorry if this all sounds too basic but I don't know how to compile C++ from | the command line at all or how to use make files, and I need to use the | Visual Studio compiler because my own C++ code relies on Microsoft | extensions... ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: Linking with C++ produced by Visual Studio .NET on Windows XP?
Cyril Schmidt wrote: I am far from being an expert, but I have seen no answer to your question so far, so I'll tell how I'd do it (however ugly that might be). I don't have a sample project, but it should be fairly easy to make it. 1. Make a DLL project in Visual Studio. VS will create a .vcproj and .sln files for you. Add your C++ source files to this project. 2. Create a .def file for your DLL. It might look like LIBRARY MyDLL EXPORTS function1 function2 where function1 and function2 are the names of the C++ functions that you want to invoke from Haskell (there can be more of them, of course), MyDLL is the name of your DLL. 3. Create an import library that can be used by ghc: dlltool -d MyDLL.def -l libMyDLL.a Thanks. The only problem is that dlltool doesn't work because I don't have cygwin installed. (I just downloaded dlltool.exe from somewhere on the web) I really don't want to install cygwin if at all possible because I'm trying to keep my system as close as possible to an end-user's system ie just winXP and nothing else (except VS and GHC) - is there a version of dlltool that can just run by itself? Regards, Brian. ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users