From f179e855e0c4c3ace51257a7175406c24f20dae3 Mon Sep 17 00:00:00 2001 From: panne Date: Sun, 16 Jun 2002 16:10:29 +0000 Subject: [PATCH] [project @ 2002-06-16 16:10:29 by panne] * Use the encoded module name for the C stub of "foreign import wrapper", so e.g. the '.' in hierarchical module names gets mangled. * Nuke unused parameter in mkFExportCBits --- ghc/compiler/deSugar/DsForeign.lhs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/ghc/compiler/deSugar/DsForeign.lhs b/ghc/compiler/deSugar/DsForeign.lhs index a89b706..706b733 100644 --- a/ghc/compiler/deSugar/DsForeign.lhs +++ b/ghc/compiler/deSugar/DsForeign.lhs @@ -21,7 +21,7 @@ import TcHsSyn ( TypecheckedForeignDecl ) import CoreUtils ( exprType, mkInlineMe ) import Id ( Id, idType, idName, mkSysLocal, setInlinePragma ) import Literal ( Literal(..) ) -import Module ( Module, moduleUserString ) +import Module ( Module, moduleString ) import Name ( getOccString, NamedThing(..) ) import OccName ( encodeFS ) import Type ( repType, eqType ) @@ -269,7 +269,7 @@ dsFExport mod_name fn_id ty ext_name cconv isDyn `thenDs` \ mod -> let (h_stub, c_stub) - = mkFExportCBits (moduleUserString mod) ext_name + = mkFExportCBits ext_name (if isDyn then Nothing else Just fn_id) fe_arg_tys res_ty is_IO_res_ty cconv in @@ -307,7 +307,7 @@ dsFExportDynamic mod_name id cconv = newSysLocalDs ty `thenDs` \ fe_id -> let -- hack: need to get at the name of the C stub we're about to generate. - fe_nm = mkFastString (moduleUserString mod_name ++ "_" ++ toCName fe_id) + fe_nm = mkFastString (moduleString mod_name ++ "_" ++ toCName fe_id) in dsFExport mod_name id export_ty fe_nm cconv True `thenDs` \ (h_code, c_code) -> newSysLocalDs arg_ty `thenDs` \ cback -> @@ -379,15 +379,14 @@ The C stub constructs the application of the exported Haskell function using the hugs/ghc rts invocation API. \begin{code} -mkFExportCBits :: String - -> FastString +mkFExportCBits :: FastString -> Maybe Id -- Just==static, Nothing==dynamic -> [Type] -> Type -> Bool -- True <=> returns an IO type -> CCallConv -> (SDoc, SDoc) -mkFExportCBits mod_nm c_nm maybe_target arg_htys res_hty is_IO_res_ty cc +mkFExportCBits c_nm maybe_target arg_htys res_hty is_IO_res_ty cc = (header_bits, c_bits) where -- Create up types and names for the real args -- 1.7.10.4