Skip to content
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

WindowsDynLib lookup function should pass a C String to GetProcAddress #2435

Closed
rivten opened this issue May 6, 2019 · 3 comments
Closed
Labels
os-windows standard library This issue involves writing Zig code for the standard library.
Milestone

Comments

@rivten
Copy link

rivten commented May 6, 2019

In here : https://github.com/ziglang/zig/blob/master/std/dynamic_library.zig#L197 , the function lookup should either : receive a C String as an input (c"MyLookupName") or reformat the Zig String input to C String. This is because GetProcAddress expects a C String.

@emekoi
Copy link
Contributor

emekoi commented May 6, 2019

this should be solved by #265, but in the mean time, i can't think of a correct solution that doesn't require a comptime, an allocator, of the user null-terminating the string themselves.

@andrewrk
Copy link
Member

andrewrk commented Sep 6, 2019

One thing you can do for now is have a buffer on the stack with, say, 512 bytes. If the length is too big for this return error.NameTooLong or similar. We can always improve this API later.

@andrewrk andrewrk added standard library This issue involves writing Zig code for the standard library. os-windows labels Sep 20, 2019
@andrewrk andrewrk modified the milestones: 0.5.0, 0.6.0 Sep 20, 2019
@andrewrk
Copy link
Member

andrewrk commented Jan 5, 2020

Solved with #265 and #2598

@andrewrk andrewrk closed this as completed Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
os-windows standard library This issue involves writing Zig code for the standard library.
Projects
None yet
Development

No branches or pull requests

3 participants