Sven Panne <[EMAIL PROTECTED]> wrote,
> Simon Marlow wrote:
> > If you can #include the header file into the Haskell source, then
> > you can get away without litlits.
>
> Of course, in the general (and in the OpenGL/GLUT) case you can't.
>
> > If your header file contains extra gumph like prot
Marcin 'Qrczak' Kowalczyk wrote:
> IMHO the following should be efficient, calling the function only
> once, near the time of the first use (if not, should be fixed):
>
> foreign import aConstant :: Int
>
> #include
> int aConstant (void)
> {
> return A_C
Fri, 25 Feb 2000 13:10:24 +0100, Sven Panne <[EMAIL PROTECTED]>
pisze:
> It's not clear to me how exactly this should be accomplished via
> foreign import. The (well, *my* :-) basic problem is: How do you
> map about 1000 numerical #defines from C header files (OpenGL/GLUT)
> efficiently to Hask
> Depending on the OpenGL version there are #defines
> or a big enum. So the only portable way without litlits would be a
> small automatically generated C program that is run as part of
> HOpenGL's configuration process and outputs Haskell definitions or
> #defines for all needed constants. Aaaar
Simon Marlow wrote:
> If you can #include the header file into the Haskell source, then
> you can get away without litlits.
Of course, in the general (and in the OpenGL/GLUT) case you can't.
> If your header file contains extra gumph like prototypes and stuff,
> you can use this little trick: [.
> It's not clear to me how exactly this should be accomplished via
> foreign import. The (well, *my* :-) basic problem is: How do you
> map about 1000 numerical #defines from C header files (OpenGL/GLUT)
> efficiently to Haskell? Saving some STG state, calling out to C land,
> and restoring some s
Simon Marlow wrote:
> I think the only answer to this is "litlits are deprecated". We'll
> have to make do with foreign imports to get these kind of constants.
It's not clear to me how exactly this should be accomplished via
foreign import. The (well, *my* :-) basic problem is: How do you
map ab
Sven writes:
> GHC-4.06 includes litlits (i.e. those thingies between ``...''') in
> interface files when the corresponding module is compiled with -O
> and sometimes inlines them in other modules. Efficient as it is,
> this can break modules which don't use the same #includes.
I think the only
GHC-4.06 includes litlits (i.e. those thingies between ``...''') in
interface files when the corresponding module is compiled with -O
and sometimes inlines them in other modules. Efficient as it is,
this can break modules which don't use the same #includes.
Example:
-- Foo.hs ---