racket / racket/gui

make-gl-bitmap exposes ffi error (maybe specific to Mac OS)

Open
#136 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Racket
Stars
68
Forks
82
PR merge metrics
No merged PRs in 30d

Description

This program:

#lang racket/base

(require racket/class racket/gui/base)

(make-gl-bitmap 10 10 (new gl-config%))

produces the following error message, both in DrRacket and at the command line:

memcpy: contract violation
  expected: cpointer?
  given: #<variable-code>
  argument position: 1st
  other arguments...:
   #<cpointer>
   40
  context...:
   /Applications/Racket v7.3/share/pkgs/gui-lib/mred/private/wx/cocoa/cgl.rkt:210:12: for-loop
   /Applications/Racket v7.3/share/pkgs/gui-lib/mred/private/wx/cocoa/cgl.rkt:187:8: surface-flush method in bitmap%
   /Applications/Racket v7.3/share/pkgs/gui-lib/mred/private/wx/cocoa/cgl.rkt:183:8: get-cairo-surface method in bitmap%
   /Applications/Racket v7.3/share/pkgs/gui-lib/mred/private/wx/cocoa/cgl.rkt:225:0: create-gl-bitmap
   "/Users/philip/Downloads/tmp-memcpy-error.rkt": [running body]
   temp37_0
   for-loop
   run-module-instance!125
   perform-require!78

I've only tested this on Mac OS so far.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the supplied make-gl-bitmap example on macOS, then inspect gui-lib/mred/private/wx/cocoa/cgl.rkt around lines 183-225, especially surface-flush and create-gl-bitmap. Trace why memcpy receives the reported value instead of a cpointer; done means the example no longer exposes this FFI contract violation.

Written by the indexing model from the issue text.

Assessment

Domain
computer-graphics, desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.