[ ghc-Bugs-775969 ] warning: implicit declaration of function foo
SourceForge.net
noreply at sourceforge.net
Wed Jul 23 09:50:08 EDT 2003
Bugs item #775969, was opened at 2003-07-22 23:17
Message generated for change (Comment added) made by simonmar
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=108032&aid=775969&group_id=8032
Category: Compiler (FFI)
Group: 6.0
>Status: Closed
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: warning: implicit declaration of function foo
Initial Comment:
Hi,
when I compile a simple program with a function
imported from C using -fffi -O, I get the following:
warning: implicit declaration of function 'foo'
the imported function simply returns its argument
multiplied by two.
if I compile it without -O option, everything is fine, but
with the -O option it gives the warning and when I run
the program it gives the wrong result ( 1.0 for any
number)
Thanks.
----------------------------------------------------------------------
>Comment By: Simon Marlow (simonmar)
Date: 2003-07-23 13:49
Message:
Logged In: YES
user_id=48280
-O implies -fvia-C. When compiling FFI code via C, the C
compiler needs to have prototypes in scope for each of the
functions you call using the FFI: this is why the C compiler
emits the warning about an implicit declaration.
The GHC User's Guide describes how to bring the correct
prototypes into scope:
http://www.haskell.org/ghc/docs/latest/html/users_guide/sec
-ffi-ghc.html#GLASGOW-FOREIGN-HEADERS
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=108032&aid=775969&group_id=8032
More information about the Glasgow-haskell-bugs
mailing list