Skip to content

Long names can cause crashes or redefinition warnings. #169

Open
@robzed

Description

@robzed

I'm adding to pForth to make it able to use SDL. I'm creating a C function bindings (rf_custom.c style) and then add add forth words to complete this so that I can use SDL2 from pForth. (This is based on ProgrammingRainbow gForth's work).

The custom c function bindings all work. I'm not adding constants and structures in Forth. The problem appears with constants like this one:

#3 constant SDL_THREAD_PRIORITY_TIME_CRITICAL

Some of the names in SDL are very long:
"SDL_THREAD_PRIORITY_TIME_CRITICAL" 33 bytes
"SDL_THREAD_PTHREAD_RECURSIVE_MUTEX" 34 bytes
"SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH" 33 bytes
"SDL_AUDIO_ALLOW_FREQUENCY_CHANGE" 32 bytes

NOTE: These are not the only ones... just the ones that were causing redefinition warnings.

For all of them (all constant), I got redefinition warnings. Some other long names I haven't.

For the last one I get a crash:
include added 896 bytes,28292 left.
Include SDL2/SDL_audio.fs
SDL_AUDIO_ALLOW_FREQUENCY_CHANGE redefined.
zsh: segmentation fault /Users/rob/Current_Projects/pForth/pforth/platforms/unix/pforth_standalone


I also notice that
1 constant SDL_AUDIO_ALLOW_FREQUENCY

Appears correctly in the dictionary as
words SDL_AUDIO_ALLOW_FREQUENCY
<>>

I also notice that
1 constant SDL_AUDIO_ALLOW_FREQUENCY_CHANGE123456789 ok

Appears in the dictionary as
words SDL_AUDIO SDL_AUDIO_ALLOW_FREQUENCY
<>

So in summary:

  • I'm going to need to extend the word length if there is a constraint.
  • I'm definite going to need to find the crash!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions