Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C2HS generates Ptr (Ptr STH) type. #220

Closed
Magicloud opened this issue Dec 11, 2018 · 1 comment
Closed

C2HS generates Ptr (Ptr STH) type. #220

Magicloud opened this issue Dec 11, 2018 · 1 comment

Comments

@Magicloud
Copy link

Similar type definitions.

{#pointer *surface_t as Surface foreign finalizer surface_destroy newtype#}
outSurface :: Ptr Surface -> IO Surface
outSurface = liftM Surface . newForeignPtr_

{#pointer *font_options_t as FontOptions foreign finalizer font_options_destroy newtype#}
outFontOptions :: Ptr FontOptions -> IO FontOptions
outFontOptions = liftM FontOptions . newForeignPtr_

Similar functions.

{#fun pattern_get_surface as ^ { `Pattern', `Surface' outSurface* } -> `Status'#}

{#fun scaled_font_get_font_options as ^ { `ScaledFont', `FontOptions' outFontOptions* } -> `()'#}

Different bindings.

foreign import ccall safe "Graphics/Cairo/Drawing/Patterns.chs.h cairo_pattern_get_surface"
  patternGetSurface'_ :: ((C2HSImp.Ptr (Pattern)) -> ((C2HSImp.Ptr (C2HSImp.Ptr (Surface))) ->   (IO C2HSImp.CInt))) -- WRONG

foreign import ccall safe "Graphics/Cairo/Fonts/ScaledFont.chs.h                                 cairo_scaled_font_get_font_options"
  scaledFontGetFontOptions'_ :: ((C2HSImp.Ptr (ScaledFont)) -> ((C2HSImp.Ptr (FontOptions)) ->   (IO ())))
@Magicloud
Copy link
Author

I see. Missed the ** in .h.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant