Re: [Haskell-cafe] Problem compiling hdbc with GHC 6.10.1 in windows

2008-11-06 Thread PJ Durai
On Thu, Nov 6, 2008 at 4:44 PM, Thomas Schilling
<[EMAIL PROTECTED]> wrote:
> You need to use base-3.  For a temporary fix, edit the file HDBC.cabal
> and change the base part of the "build-depends" to look like this:
> base == 3.*, (wherever it occurs)
>

That worked.
Thanks!

> 2008/11/6 PJ Durai <[EMAIL PROTECTED]>:
>> Greetings
>>
>> I would like to report that I am not able to compile hdbc 1.1.5.0.
>>
>> $ runghc.exe Setup.lhs build
>> Preprocessing library HDBC-1.1.5...
>> Building HDBC-1.1.5...
>> [1 of 6] Compiling Database.HDBC.ColTypes ( Database\HDBC\ColTypes.hs,
>> dist\build\Database\HDBC\ColTypes.o )
>> [2 of 6] Compiling Database.HDBC.Statement (
>> Database\HDBC\Statement.hs, dist\build\Database\HDBC\Statement.o )
>> [3 of 6] Compiling Database.HDBC.Types ( Database\HDBC\Types.hs,
>> dist\build\Database\HDBC\Types.o )
>> [4 of 6] Compiling Database.HDBC.DriverUtils (
>> Database\HDBC\DriverUtils.hs, dist\build\Database\HDBC\DriverUtils.o )
>> [5 of 6] Compiling Database.HDBC.Utils ( Database\HDBC\Utils.hs,
>> dist\build\Database\HDBC\Utils.o )
>> Database\HDBC\Utils.hs:51:11: Not in scope: `catchDyn'
>> Database\HDBC\Utils.hs:55:16: Not in scope: `catchDyn'
>> Database\HDBC\Utils.hs:60:18: Not in scope: `dynExceptions'
>>
>> Environment:
>> Windows XP SP2
>> GHC 6.10.1
>>
>> thanks
>> pj
>>
>> I had no problems compiling this with GHC 6.8.
>> ___
>> Haskell-Cafe mailing list
>> Haskell-Cafe@haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>
>
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Problem compiling hdbc with GHC 6.10.1 in windows

2008-11-06 Thread PJ Durai
Greetings

I would like to report that I am not able to compile hdbc 1.1.5.0.

$ runghc.exe Setup.lhs build
Preprocessing library HDBC-1.1.5...
Building HDBC-1.1.5...
[1 of 6] Compiling Database.HDBC.ColTypes ( Database\HDBC\ColTypes.hs,
dist\build\Database\HDBC\ColTypes.o )
[2 of 6] Compiling Database.HDBC.Statement (
Database\HDBC\Statement.hs, dist\build\Database\HDBC\Statement.o )
[3 of 6] Compiling Database.HDBC.Types ( Database\HDBC\Types.hs,
dist\build\Database\HDBC\Types.o )
[4 of 6] Compiling Database.HDBC.DriverUtils (
Database\HDBC\DriverUtils.hs, dist\build\Database\HDBC\DriverUtils.o )
[5 of 6] Compiling Database.HDBC.Utils ( Database\HDBC\Utils.hs,
dist\build\Database\HDBC\Utils.o )
Database\HDBC\Utils.hs:51:11: Not in scope: `catchDyn'
Database\HDBC\Utils.hs:55:16: Not in scope: `catchDyn'
Database\HDBC\Utils.hs:60:18: Not in scope: `dynExceptions'

Environment:
Windows XP SP2
GHC 6.10.1

thanks
pj

I had no problems compiling this with GHC 6.8.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] HDBC-ODBC linking problems in windows.

2008-08-04 Thread PJ Durai
On 8/3/08, Andrew Appleyard <[EMAIL PROTECTED]> wrote:
> Hi PJ,
>
> On 2/08/2008 4:09 AM, you wrote:
> > I am having issues getting hdbc/odbc working on windows.
> >
> > When using GHC, I am not able to compile a simple program. It ends up
> > with linker errors like
> > [...]
> > Is there an easy workaround for this? Or am I doing something wrong?
> >
> > MySetup
> > ===
> > Windows XP SP2
> > ghc 6.8.3
> > hdbc  1.1.5.0
> > hdbc-odbc 1.1.4.3.0
> >
>
> hdbc-odbc 1.1.4.4 contains a patch to the calling convention of the ODBC
> functions (from ccall to stdcall).
>
> Grab version 1.1.4.4 from Hackage [1] and hopefully that'll fix your
> problem.
>
> [1]
> http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HDBC-odbc

That works !
Thanks.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] HDBC-ODBC linking problems in windows.

2008-08-01 Thread PJ Durai
Greetings everyone,

I am having issues getting hdbc/odbc working on windows.

When using GHC, I am not able to compile a simple program. It ends up
with linker errors like

C:\Program 
Files\Haskell\HDBC-odbc-1.1.4.3\ghc-6.8.3/libHSHDBC-odbc-1.1.4.3.a(Connection.o)(.text+0x52c):fake:
undefined reference to `SQLAllocHandle'
C:\Program 
Files\Haskell\HDBC-odbc-1.1.4.3\ghc-6.8.3/libHSHDBC-odbc-1.1.4.3.a(Connection.o)(.text+0x5b8):fake:
undefined reference to `SQLSetEnvAttr'
C:\Program 
Files\Haskell\HDBC-odbc-1.1.4.3\ghc-6.8.3/libHSHDBC-odbc-1.1.4.3.a(Connection.o)(.text+0x62c):fake:
undefined reference to `SQLDriverConnect'
C:\Program 
Files\Haskell\HDBC-odbc-1.1.4.3\ghc-6.8.3/libHSHDBC-odbc-1.1.4.3.a(Connection.o)(.text+0x700):fake:
undefined reference to `SQLEndTran'
C:\Program 
Files\Haskell\HDBC-odbc-1.1.4.3\ghc-6.8.3/libHSHDBC-odbc-1.1.4.3.a(Connection.o)(.text+0x770):fake:
undefined reference to `SQLGetInfo'
C:\Program Files\Haskell\HDBC-odbc-1

When I use ghci, it exits silently.

It looks like calling convension mix-up in FFI declarations to me.

I ran 'dumpbin'  on odbc32.lib and all the exported function names are
decorated like they are PASCAL calls, not ccall's. But GHC in this
case is looking for undecorated names.

I assume it works as is on Unix (unixODBC) ?

Is there an easy workaround for this? Or am I doing something wrong?

MySetup
===
Windows XP SP2
ghc 6.8.3
hdbc  1.1.5.0
hdbc-odbc 1.1.4.3.0

appreciate your time.
Thanks
pj
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Linker problems linking FFI import call in Windows

2008-07-16 Thread PJ Durai
On 7/16/08, Olivier Boudry <[EMAIL PROTECTED]> wrote:
> On Tue, Jul 15, 2008 at 11:51 PM, PJ Durai <[EMAIL PROTECTED]> wrote:
> > I am trying to import some functions from a windows DLL. I am getting
> > strange errors. (This used to work with previous versions of GHC.  6.6
> > I think.).
>
> You may have to create an import library for the DLL. I had a similar
> problem and solved it that way.
>
> Look at http://www.emmestech.com/moron_guides/moron1.html for advices
> on how to create such a library.
>
> My problem was that the exports in the dll were prefixed with an
> underscore. I had to remove them from the .def file before creating
> the import library.
>
I do have the import library. It came with the DLL. It links properly
when I use CCALL on the haskell import statements. Doesnt link when I
use STDCALL. It looks for  function name with something like '@4 or
@8' tacked on at the end. Not sure what that is all about.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Linker problems linking FFI import call in Windows

2008-07-15 Thread PJ Durai
Greetings

I am trying to import some functions from a windows DLL. I am getting
strange errors. (This used to work with previous versions of GHC.  6.6
I think.).

This is my import statement:

foreign import stdcall  "ace.h AdsConnect" adsConnect' :: CString ->
Ptr CInt -> IO CInt

This is the build output.

C:\moonar>\bin\make.exe
ghc --make -ffi main.hs  -ffi adsapi.hs -optc -DWIN32 native.cpp  -lace32 -L/hom
e/pjdurai/dev/moonar  -L/tmp/Advantage -o moonar.exe
[1 of 2] Compiling AdsApi   ( adsapi.hs, adsapi.o )
[2 of 2] Compiling Main ( main.hs, main.o )
Linking moonar.exe ...

adsapi.o(.text+0x124):fake: undefined reference to [EMAIL PROTECTED]'
adsapi.o(.text+0x260):fake: undefined reference to [EMAIL PROTECTED]'
collect2: ld returned 1 exit status
make: *** [main.exe] Error 1

It actually links without errors if I use 'ccall' instead of
'stdcall'. But the executable segfaults when the function is called.

I had the same code working with 'stdcall' declaration a while ago.
(With GCH 6.6 I think)

I am using ghc-6.8.3 on Windows XP SP2.

appreciate your time.
thanks
pj
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Seeking advice on best practices with FFI

2008-05-09 Thread PJ Durai
Hello,

I am trying to write FFI wrappers for a dynamic library in windows.
I would like to get some help in how to go about doing things.

For example for this C function, the import and wrapper I came up with
are listed below.

-- STATUS LNPUBLIC NSFDbOpen (char far *PathName, DBHANDLE far *rethDB);


foreign import stdcall "nsfdb.h NSFDbOpen" nsfDbOpen' ::CString -> Ptr
CInt -> IO CInt

type DbHandle = CInt

nsfDbOpen :: String -> IO DbHandle
nsfDbOpen dbname = alloca $ \ptr -> do
 db <- newCString dbname
 rc <- nsfDbOpen' db ptr
 handle <- peek ptr
 if rc /= 0 then error "dbopen failed" else return handle

Q: Does that look ok?  Is the db <- newCString leaking ?


Q:  How would I import and call a function with signature like this

calling C code:

char str1[MAX_PATH];
char str2[MAX_PATH];

GetStringValues( str1, str2);

called C function signature is:
void  GetStringValues( char* s1, char* s2);

i.e. how would the haskell import (and the wrapper function) look like
in situation like this (where I have to pass preallocated char array
to C code and get it filled up)?


Appreciate your time.
thanks
pj
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe