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

Isn't DllImport slow? #27

Open
Shadowblitz16 opened this issue Dec 2, 2021 · 1 comment
Open

Isn't DllImport slow? #27

Shadowblitz16 opened this issue Dec 2, 2021 · 1 comment

Comments

@Shadowblitz16
Copy link

Isn't DllImport slow?
Would this even be viable for os dev?

@MichalStrehovsky
Copy link
Owner

You can see for yourself in the disassembly.

This line:

%ILCPATH%\ilc zerosharp.ilexe -g -o zerosharp.obj --systemmodule zerosharp --map zerosharp.map -O --directpinvoke:kernel32 || goto Error

(--directpinvoke:kernel32)

makes all DllImports statically bound. They have the same overhead as an extern DllImport in C (they go through a single jmp instruction on x64).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants