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

typedef support (Closes #135) #238

Merged
merged 1 commit into from Dec 31, 2014

Conversation

Projects
None yet
2 participants
@edwintorok

Preserve the view type formatter when projecting types.
Also introduce a convenience wrapper that just typedefs.

With these changes it is possible to support "anonymous" types in C stubs
as in issue #135, for example given:
typedef struct { ... } SDL_JoystickGUID

let joystick_guid : joystick_guid typ = structure "_SDL_JoystickGUID"
(* ... *)
let joystick_guid =
typedef "SDL_JoystickGUID" joystick_guid

let joystick_get_guid_string =
foreign "SDL_JoystickGetGUIDString"
(joystick_guid @-> ptr char @-> int @-> returning void)

Ctypes should generate 'SDL_JoystickGUID x1696 = ...' instead of
'struct _SDL_JoystickGUID x1696 = ...' which would fail to compile.

typedef support (Closes #135)
Preserve the view type formatter when projecting types.
Also introduce a convenience wrapper that just typedefs.

With these changes it is possible to support "anonymous" types in C stubs
as in issue #135, for example given:
typedef struct { ... } SDL_JoystickGUID

let joystick_guid : joystick_guid typ = structure "_SDL_JoystickGUID"
(* ... *)
let joystick_guid =
  typedef "SDL_JoystickGUID" joystick_guid

let joystick_get_guid_string =
  foreign "SDL_JoystickGetGUIDString"
    (joystick_guid @-> ptr char @-> int @-> returning void)

Ctypes should generate 'SDL_JoystickGUID x1696 = ...' instead of
'struct _SDL_JoystickGUID x1696 = ...' which would fail to compile.
@yallop

This comment has been minimized.

Show comment
Hide comment
@yallop

yallop Dec 31, 2014

Member

This looks good to me. Thanks for the contribution!

Member

yallop commented Dec 31, 2014

This looks good to me. Thanks for the contribution!

yallop added a commit that referenced this pull request Dec 31, 2014

Merge pull request #238 from edwintorok/typedef
typedef support (Closes #135)

@yallop yallop merged commit 690258c into ocamllabs:master Dec 31, 2014

2 checks passed

continuous-integration/appveyor AppVeyor build succeeded
Details
continuous-integration/travis-ci The Travis CI build passed
Details

@edwintorok edwintorok deleted the edwintorok:typedef branch Dec 31, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment