Re: Exporting a String

2001-09-27 Thread Sven Eric Panitz


I am no expert in these things, but
as a matter of fact I just did some quite similar and found
the help in the mailing list archive. (at least I did not find
a cookbook for this in the documentation)

My Haskell module:
==

module Mini where
import CString

foreign export stdcall cAppend :: CString -> CString -> IO CString

cAppend :: CString -> CString -> IO CString
cAppend cxs cys
 = do
xs <- peekCString cxs
ys <- peekCString cys
erg <- return (xs++ys)
newCString erg


And my C program Main.c calling this function:
==

#include 
#include "Mini_stub.h"
#include "RtsAPI.h" 

extern void __stginit_Mini ( void ); 

int main(void)
{
   char* bogusFlags[1] = { "\0" }; 
   char* test;   

   //starting up Haskell runtime
   startupHaskell(0, bogusFlags, __stginit_Mini);

   //calling Haskell function
   test=cAppend("the world"," is my oyster"); 

   //printing its result
   printf("%s\n", test);

   //say bye bye to Haskell
   shutdownHaskell();

   return 0;
}


and my way to build this thing:
===
ghc -fglasgow-exts -package text -c Mini.hs
gcc -I. -I'e:/Program Files/ghc/ghc-5.02/include' -I'E:\Program 
Files\ghc\ghc-5.02\include\mingw' -c Main.c
ghc -fglasgow-exts -no-hs-main -package text -static Main.o Mini.o Mini_stub.o -o 
Test.exe




Please some expert correct me, if this is not the right way to
do this.

Sven Eric


-- 
__
Sven Eric Panitz Uhlandstr. 12   D-64297 Darmstadt
Software AG   [EMAIL PROTECTED] (+49)6151-92-1426 
---  when I cannot sing my heart, I can only speak my mind ---


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Why have file names with 3 components?

2001-09-27 Thread George Russell

This looks like a bug, but please don't change it!

If you have a file A.blah.hs containing a module A, ghc5.02 compiles it, producing 
A.hi and A.blah.o.
I have an application for this, since I have just, for the first time, been 
reluctantly 
compelled to introduce recursive modules.  Rather than writing .hi-boot files (which 
might have
to be rewritten for ghc5.03) I have instead written .boot.hs files, which yield .hi 
files, which
then get moved to .hi-boot.   Thus a module A has two sources, the real source A.hs, 
but also
the source for the .hi-boot file, A.boot.hs.

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



RE: Cash Prizes Win!

2001-09-27 Thread Ashley Yakeley

At 2001-09-27 03:48, Simon Marlow wrote:

>I could turn on subscriber-only posting if there's a consensus to do
>that.  

I vote for that.

>It might be inconvenient in that you have to post from the same
>account that you read Haskell mail from though, and I know some people
>have separate email accounts just for receiving Haskell mail.

I also run an email list using Mailman. Anytime a subscriber sends a 
message from a 'wrong' address, Mailman catches it, and I simply 
subscribe that address 'nomail', and approve the message.

>Also, what do people think about the volume of Conference-related
>announcements sent to the list ([EMAIL PROTECTED] in particular)?

I'm not really bothered by the way it is...

-- 
Ashley Yakeley, Seattle WA


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: More 5.02 downloads

2001-09-27 Thread Jon Fairbairn

> I've updated the 5.02 Windows InstallShield, getting rid of one or two
> teething problems, and improving the availability of the docs.
> 
> I've also added links to the RedHat 7.1 RPMs and FreeBSD/x86 binary
> dist.
> 
> http://www.haskell.org/ghc/download_ghc_502.html

I'm not sure who to mention this to, but the mirror at
http://www.mirror.ac.uk/sites/www.haskell.org/ghc/download_ghc_502.html>
links to some dvi about the new runtime system instead of
the base rpm! (It's preferable for me to download from a UK location)

  Jón
-- 
Jón Fairbairn [EMAIL PROTECTED]
31 Chalmers Road [EMAIL PROTECTED]
Cambridge CB1 3SZ+44 1223 570179 (after 14:00 only, please!)



___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Exporting a String

2001-09-27 Thread Juan Ignacio García García

hello,

Is there any way to export a value of type String?
I have tried it as follows

Haskell code
 foreign export f::Int -> IO (StablePtr String)
 f:: Int -> IO (StablePtr String)
 f n = newStablePtr ("hola")

C code
 char *cad;
 cad=f(5);
 printf("%s",cad);

but it does not go (segmentation fault).

Thanks in advance,

J. Ignacio García

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



Re: packages in ghci

2001-09-27 Thread Reuben Thomas

> I just downloaded the nice installation of ghc 5.02 for windows.
> 
> I have just some problem when trying to start ghci with a
> package as described in the manual:
> 
> > E:\hs\Quip>ghci -package text

Works fine for me.

> > e:\PROGRA~1\ghc\ghc-5.02\bin\ghc.exe: no input files
> > Usage: For basic information, try the `--help' option.
> >
> > E:\hs\Quip>
> 
> Adding a Haskell source file as further parameter does not really help:
> 
> > E:\hs\Quip>ghci -package text M.hs
> > A' does not existhc-5.02\bin\ghc.exe: file `=

This looks as though there's some problem involving carriage returns,
as the error seems to wrap from the end of the line back to the beginning.

> Any idea, what I am doing wrong?

Nope. What's your PATH like? What version of Windows are you using?

-- 
http://sc3d.org/rrt/ | wit, n.  educated insolence (Aristotle)

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



packages in ghci

2001-09-27 Thread Sven Eric Panitz


I just downloaded the nice installation of ghc 5.02 for windows.

I have just some problem when trying to start ghci with a
package as described in the manual:

> E:\hs\Quip>ghci -package text
> e:\PROGRA~1\ghc\ghc-5.02\bin\ghc.exe: no input files
> Usage: For basic information, try the `--help' option.
> 
> E:\hs\Quip>

Adding a Haskell source file as further parameter does not really help:

> E:\hs\Quip>ghci -package text M.hs
> A' does not existhc-5.02\bin\ghc.exe: file `=
> 
> E:\hs\Quip>


Any idea, what I am doing wrong?

Sven Eric



-- 
__
Sven Eric Panitz Uhlandstr. 12   D-64297 Darmstadt
Software AG   [EMAIL PROTECTED] (+49)6151-92-1426 
---  when I cannot sing my heart, I can only speak my mind ---


___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



RE: Cash Prizes Win!

2001-09-27 Thread Simon Marlow

[ Ketil Malde asks about recent spam on Haskell mailing lists... ]
> How about disallowing non-subscribers from posting?  This list is my
> main source of spam these days.  (Effective filtering is your friend)

My apologies for this spam that got through.  Mailman's automatic
filtering catches *most* of the spam bound for the list - there are
usually a few messages per day.  The ones that get through are very much
the exception, but it does occasionally happen.

I could turn on subscriber-only posting if there's a consensus to do
that.  It might be inconvenient in that you have to post from the same
account that you read Haskell mail from though, and I know some people
have separate email accounts just for receiving Haskell mail.  What do
people think?

Also, what do people think about the volume of Conference-related
announcements sent to the list ([EMAIL PROTECTED] in particular)?
Most of these get caught by the filter, and I tend to disallow only
those that have no connection to programming language research at all.
This could be tightened to Haskell-related or functional
programming-related conferences only.

Cheers,
Simon

___
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users