-
Notifications
You must be signed in to change notification settings - Fork 4
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
subprograms with C string arguments #19
Comments
Thanks for reporting. Option 2 was the intention. I probably forgot to move the import to the body and implement the usual conversion in the function body. The bad thing is that these kinds of errors are not detected by the linking phase. I wonder if there would be more erroneous cases, there are many functions I've not tested myself. I'll try to detect that and fix all of them. |
…Shader See issue: subprograms with C string arguments #19
I've fixed the code in the master branch. All the subprograms with a string parameter in this package were affected, but the remaining ones look good. @Fabien-Chouteau, could you confirm it works for you? Then we can close the issue. |
Thanks @mgrojo , it works but not in all cases. At least for the some of the shaders function, passing For instance when I do: This.Glow_Shader := createFromMemory
("",
"",
ASFML_Sim.Window.Shaders.Glow); There's an error because empty string is not a valid shader. One option would be to not convert the string and just pass null C_vertexShader : chars_ptr :=
(if vertexShader'Length /= 0
then New_String (vertexShader)
else Null_Ptr); But then I don't know if there are cases where you want to pass an actual empty string and not a |
I thought CSFML would treat both cases equivalently, but it calls different C++ methods depending on being Let's suppose that there's no need to pass |
See issue: subprograms with C string arguments #19
Implemented for the functions mentioning NULL for strings. Let me know if there is still any problem. |
@Fabien-Chouteau I plan to publish a new release, and apparently this is fixed. Feel free to comment and/or reopen this if there is something still missing. |
Hi @mgrojo, I was trying to use shaders functions such as
Sf.Graphics.Shader.createFromFile
orSf.Graphics.Shader.createFromFile
and got into problems. The issue is that those functions expect C strings (a.k.a. pointers) and the AdaString
type is not that.I see two complementary solutions to that:
Interfaces.C.Strings .chars_ptr
, and let the users do the conversion.String
friendly version of the function that does the conversion for the users.Thanks for all the great work :)
The text was updated successfully, but these errors were encountered: