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 Haskell? Saving some STG state, calling out to C land,
> and restoring some state for accessing every value will definitely
> make my binding about 1-2 orders slower.

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 <header.h>
int aConstant (void)
{
    return A_CONSTANT;
}

A tool could be helpful in massive generating such functions...

-- 
 __("<    Marcin Kowalczyk * [EMAIL PROTECTED] http://qrczak.ids.net.pl/
 \__/              GCS/M d- s+:-- a22 C+++$ UL++>++++$ P+++ L++>++++$ E-
  ^^                  W++ N+++ o? K? w(---) O? M- V? PS-- PE++ Y? PGP+ t
QRCZAK                  5? X- R tv-- b+>++ DI D- G+ e>++++ h! r--%>++ y-

Reply via email to