Simon Peyton-Jones wrote:
The main program must be in package 'main', which is why compiling ShowClasses with 
"-package-name javavm" doesn't work.  I'll modify the documentation to say this 
more clearly

When you say "import JVMBoot", and your javavm package is not installed, GHC thinks you mean 
"JVMBoot from package main".  The only way at the moment you can make GHC realise you mean 
"JVMBoot from package javavm" is to install it.

You may say that's a bit silly -- after all, GHC can simply look at the 
interface file, and that is what you want here. I'll talk to Simon about 
whether that could be possible, but I'm guessing there's a good reason why not.

It would be a bit strange to allow this. The compiler knows nothing about the javavm package at this stage: it isn't installed. So if we came across a module that we were expecting to be part of the main package and it turns out to belong to another, non-existant, package, we'd probably have to invent a package. I just don't have a clear idea for how this would work; my gut feeling is that we shouldn't pursue it, since the right way is to register the package with GHC first (temporarily, to a local database, perhaps).

Cheers,
        Simon

Anyway, the solution for you is to install it.  Cabal?  There must be a 
well-understood process but I'm not the one to ask.

Simon

| -----Original Message-----
| From: [EMAIL PROTECTED] [mailto:glasgow-
| [EMAIL PROTECTED] On Behalf Of Ashley Yakeley
| Sent: 22 December 2006 10:44
| To: glasgow-haskell-users@haskell.org
| Subject: importing "in place" and packages
|
| I'm compiling the files for package "javavm" with GHC 6.6 (using
| "-package-name javavm"). As part of the compilation process, I need a
| runnable program that uses the modules I've compiled "in place":
|
|    import JVMBoot
|
| But I get this error when compiling my "Main" module (ShowClasses.hs):
|
| ShowClasses.hs:23:1:
|      Bad interface file: JVMBoot.hi
|          Something is amiss; requested module  main:JVMBoot differs
| from
| name found in the interface file javavm:JVMBoot
|
| Really I want to import javavm:JVMBoot, not main:JVMBoot. I tried this,
| but GHC doesn't like it (because it's not Haskell):
|
|   import javavm:JVMBoot
|
| I tried compiling ShowClasses.hs with "-package-name javavm". This let
| me compile, but then I get this on link:
|
| /usr/bin/ld: Undefined symbols:
| _ZCMain_main_closure
| ___stginit_ZCMain
| collect2: ld returned 1 exit status
|
| I tried adding a -main-is in the compile step, but this didn't help.
|
| Is there any way to create a main function that calls files imported
| "in
| place" that are in some package? I have the same issue when writing
| tests for my "time" package.
|
| --
| Ashley Yakeley
|
| _______________________________________________
| Glasgow-haskell-users mailing list
| Glasgow-haskell-users@haskell.org
| http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to