Skip to content

Compile errors and more on raygui #17

@greenfork

Description

@greenfork

Hi, there are a couple of errors trying to compile just generated files on linux:

raylib.nim(788, 15) Error: expected closing ')'
caused by
proc MemFree*(ptr: pointer)
fixed by renaming ptr
proc MemFree*(ptr1: pointer)
raygui.nim(288, 21) Error: invalid pragma: RAYGUIDEF
caused by missing pragma definition
fixed by adding to raygui.nim
{.pragma: RAYGUIDEF, cdecl, discardable, dynlib: "libraygui" & LEXT.}

Also, not a problem but {.pragma: RLAPI, cdecl, discardable, dynlib: "libraylib" & LEXT.} is generated twice on lines 75-76 in raylib.nim.

UPDATE: when compiling example from examples/texture/image_processing.nim, this chunk of code in raylib.nim does not work

# Temporal hack to avoid breaking old codebases using
# deprecated raylib implementation of these functions
template FormatText*(): auto = TextFormat
template LoadText*(): auto = LoadFileText
template GetExtension*(): auto = GetFileExtension
template GetImageData*(): auto = LoadImageColors

it needs to be located below type definitions and be rewritten to forward all arguments, like this:

template GetImageData*(image: Image): auto = LoadImageColors(image)

It was a bit hard for me to compile raygui library as a dynamic library with no previous experience of doing so, maybe it is helpful to at least leave some notes on how to do this. Here is what I did on linux, probably not ideal:

$ cd /home/grfork/reps
$ git clone https://github.com/raysan5/raygui.git
$ cd raygui/src
$ mkdir build
$ cd build
$ cp ../raygui.h raygui.c
$ gcc -fPIC -c raygui.c -DRAYGUI_IMPLEMENTATION
$ gcc -shared -o libraygui.so raygui.o

After that example from examples/original/basic.nim compiles with:

nim c -o:thegame --passL:"-L/home/grfork/reps/raygui/src/build -lraylib" src/thegame.nim
LD_LIBRARY_PATH=/home/grfork/reps/raygui/src/build/ ./thegame

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions