T. Do
T. Do

Reputation: 51

GHCi could not load .dll lib (C++ lib) on Windows

I've installed a C++ lib successfully via vcpgk, named: lmdb:x64-windows

I also installed lmdb binding package for Haskell by Cabal install

And when trying to test the lmdb package:

module Persistence where

import Database.LMDB.Raw

GHCi compiled and loaded it:

[1 of 1] Compiling Persistence      ( Persistence.hs, interpreted )
Ok, modules loaded: Persistence.

But it throws error when I try to call any functions in lmdb Raw lib:

*Persistence> lmdb_version
ghc.exe: addDLL: lmdb.dll (Win32 error 126): The specified module could not 
be found.
ghc.exe: Could not load `lmdb.dll'. Reason: addDLL: could not load DLL
ghc.exe: C:\Users\thanhdo\AppData\Roaming\cabal\x86_64-windows-ghc-
8.0.2\lmdb-0.2.5-1uQhV16mebP51rtMgitOcY\HSlmdb-0.2.5-
1uQhV16mebP51rtMgitOcY.o: unknown symbol `mdb_dbi_close'
ghc.exe: unable to load package `lmdb-0.2.5'

I was searching around and was trying several approaches but still can't resolve this error. I'm using Windows 7 64bit, Haskell platform 8.0.2. Thanks in advance.

Upvotes: 2

Views: 649

Answers (1)

T. Do
T. Do

Reputation: 51

As per discussion in comment section, I was trying to tell GHCi the location of lmdb's dll. It works after I modify %path% env. In my case, the path was: vcpkg\installed\x64-windows\bin

Upvotes: 1

Related Questions