haskell - making windows dll libraries - segfault -
currently, try compile haskell library, compiled on arch linux so. shared library), windows dll library. have read, cabal not support making haskell dll libraries out of box. according https://downloads.haskell.org/~ghc/7.0.3/docs/html/users_guide/win32-dlls.html have compiled such library dll (compilation works).
ghc -shared -o liblogic.dll dist/build/hslogic_ka1qey80kefkgyu69otwoe.o \ /c/ghc/ghc-7.10.1/lib/conta_47ajk3tbda43dfwyef3ohq/hscontainers-0.5.6.2-47ajk3tbda43dfwyef3ohq.o \ .cabal-sandbox/i386-windows-ghc-7.10.1/missi_1lzqat04j1ylhrfgdhk9qx/libhsmissingh-1.3.0.1-a2uvxmrfu \ xwgzuhs3vx4et.a .cabal-sandbox/i386-windows-ghc-7.10.1/text_8rmotivs8isbkxp7uzusgu/hstext-1.2.1.1-1l7lzluz0bo8rou5dnnfwq.o \ .cabal-sandb ox/i386-windows-ghc-7.10.1/regex_1wudnazwyemj7hjtqevdzk/hsregex-base-0.93.2-csrfago3jfi7vn1y74k9dt.o \ .cabal-sandbox/i386-windows-ghc-7.10.1/regex_4emnrbpiuin81ua3rzcqhm/hsregex-compat-0.95.1-dsathvjcdprgceypq2iyog.o \ .cabal-sandbox/i386-windows-ghc-7.10.1/regex_fcyoj8fpgysar4juiv3onx/hsregex-posix-0.95.2-hrkrtqubtek4geur7lgllg.o /c/ghc/ghc-7.10.1/lib/bytes_6vj5eolihgnhishcvcb069/hsbytestring-0.10.6.0-6vj5eolihgnhishcvcb069.o \ /c/ghc/ghc-7.10.1/lib/deeps_fpr4obozalu1lutwnrbldi/hsdeepseq-1.4.1.1-fpr4obozalu1lutwnrbldi.o \ /c/ghc/ghc-7.10.1/ lib/binar_eke3c9lmxb3dqpu0fptru6/hsbinary-0.7.3.0-eke3c9lmxb3dqpu0fptru6.o \ /c/ghc/ghc-7.10.1/lib/array_fahmcbffurm8kmzley8d5s/hsarray-0.5.1.0-fahmcbffurm8kmzley8d5s.o \ .cabal-sandbox/i386-windows-ghc-7.10.1/split_ezxnp9mcx6zdnuvrche0sw/hssplit-0.2.2-ecqml2wfbepdkscjwazauo.o
this dll library later used link program (qt project)
win32:libs += -l../lcng-gui -llogic ../lcng-gui/liblogic.dll.a
qt compilation succeeds, when try run program - segfaults in strlen/_mingw_pformat.
what wrongly , can succeed in creating haskell dll library used in program linked?
library -- .hs or .lhs file containing main module. ghc-options: -o3 -fwarn-unused-imports extensions: cpp
-- modules included in executable, other main. -- other-modules: -- language extensions used modules in package. -- other-extensions: -- other library packages modules imported. build-depends: base >=4.8 && <4.9, containers >=0.5 && <0.6,hunit==1.2.*,split,text,missingh,parsec >= 3 -- directories containing source files. hs-source-dirs: src c-sources: src/hsbracket.c extra-libraries: hsrts-ghc7.10.1 -- base language package written in. default-language: haskell2010 -- extra-libraries: libhsrts-ghc7.10.1 exposed-modules: bindings,utils.expressions,parser.expressions,parser.tokenizers, types.simple,types.lexpressions,parser.operations, provers.prover,utils.commands,parser.simplifiers, converters.cnf,converters.lcn,converters.operators, utils.types.lexpressions,utils.history,parser.state, solvers.cnf,graphs.lcn,utils.sat,types.chess,graphs.formula, graphs.search,types.graphs
and hsbracket defined accordingly ghc documentation:
#include <hsffi.h> static void my_enter(void) __attribute__((constructor)); static void my_enter(void) { static char *argv[] = { "liblogic.dll", 0 }, **argv_ = argv; static int argc = 1; hs_init(&argc, &argv_); } static void my_exit(void) __attribute__((destructor)); static void my_exit(void) { hs_exit(); }
Comments
Post a Comment