Importing SDL2 functions in an extern file #38
-
I tried to split the SDL example into two files, as a base to create a SDL binding. So I moved all the SDL related stuff into sdl.nelua, deleted all the local's and added a require 'sdl' statement. But then the compiler complains about the symbols in sdl.nelua being undeclared. main.nelua:
Or if I leave the 'local' there, it (as intended) doesn't find SDL_Init at all. Global doesn't help either, I have to declare an empty record and put the functions in there:
Is this intended behaviour? (Sorry, I can't get the line breaks right) |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
For complete SDL2 bindings I suggest to use https://github.com/edubart/nelua-decl/blob/main/libs/sdl2/sdl2.nelua |
Beta Was this translation helpful? Give feedback.
-
Thanks. Interesting, I must have made some mistake because I couldn't get it work without a record (which is comfortable anyways) but I'll have a deeper look and contribute some bindings if I find the time to make them :) Is there a forum or chat about nelua yet? I really like the language and would like to use it later to write an OS kernel for which it appears to be well suited to me, as I'd just have to implement some basic libc functions to get it running but would be nice to talk with other nelua people! |
Beta Was this translation helpful? Give feedback.
-
There is the Discord chat server: |
Beta Was this translation helpful? Give feedback.
For complete SDL2 bindings I suggest to use https://github.com/edubart/nelua-decl/blob/main/libs/sdl2/sdl2.nelua
Check in this file how I export symbols to other files, also see the sdl-test.nelua in the same repository as a usage example.