How do you call a void C function in Haskell

I am trying to call a main C function of a file in Haskell using an external function interface.

The main function is declared:

int main(void);

      

I can't figure out what to say to a Haskell function associated with a void type. I cannot change the C source code.

Any help is appreciated.

+3


source to share


1 answer


A function that accepts " void

as in C does not take any arguments (this sounds more like a C question than a Haskell question). Importing a type is easy IO Int

."



(Note that it might not be a good idea to call the actual function main

from Haskell via FFI, but that is up to you.)

+6


source







All Articles