
Hi, Attached is a patch that is useful (but not essential) for Windows FFI to work slightly better. Hugs builds up a command line that it passes to the compiler, for example: gcc -blah1 <filename> -blah2 In certain compilers -blah2 would not apply to <filename>, as a result when compiling with MSVC, the use of blah2 after <filename> generates a warning, but still works. The simple solution is the attached patch which moves -blah2 before <filename>. Does this harm gcc? If not then its probably a useful patch. If yes, then I'll get over it. There are a few other patches required for FFI - since the command line used by Hugs in the tree hasn't worked with visual studio compilers for a long time - I'll commit some patches tonight. With these tweaks, ffihugs works just great with windows. The only thing potentially missing is a warning that your carefully written C file is about to be trashed by ffihugs if you do the "obvious" thing. Or perhaps hugs should use a different name for the file generates, like test.temp.hugs.c ? Just anything thats less likely to clash. Thanks Neil

On Wed, Apr 26, 2006 at 06:55:58PM +0100, Neil Mitchell wrote:
Hugs builds up a command line that it passes to the compiler, for example:
gcc -blah1 <filename> -blah2
In certain compilers -blah2 would not apply to <filename>, as a result when compiling with MSVC, the use of blah2 after <filename> generates a warning, but still works. The simple solution is the attached patch which moves -blah2 before <filename>.
Does this harm gcc?
I'm afraid it does: the arguments are usually C files and -l options for libraries, and the libraries are scanned in the order they appear. Put them too early, and it fails to find a symbol defined in a later file. Perhaps we should make it vary.
There are a few other patches required for FFI - since the command line used by Hugs in the tree hasn't worked with visual studio compilers for a long time - I'll commit some patches tonight.
Great.
With these tweaks, ffihugs works just great with windows. The only thing potentially missing is a warning that your carefully written C file is about to be trashed by ffihugs if you do the "obvious" thing.
Sorry about that. I've already added such a warning.

Does this harm gcc?
I'm afraid it does: the arguments are usually C files and -l options for libraries, and the libraries are scanned in the order they appear. Put them too early, and it fails to find a symbol defined in a later file. Perhaps we should make it vary.
What if we move the -o option before the filename? Then there won't usually be a warning, which is better. Thanks Neil

On Wed, Apr 26, 2006 at 07:42:58PM +0100, Neil Mitchell wrote:
Does this harm gcc?
I'm afraid it does: the arguments are usually C files and -l options for libraries, and the libraries are scanned in the order they appear. Put them too early, and it fails to find a symbol defined in a later file. Perhaps we should make it vary.
What if we move the -o option before the filename? Then there won't usually be a warning, which is better.
That would be fine.
participants (2)
-
Neil Mitchell
-
Ross Paterson