Skip to content

Add ImportC support via dmd -H. - #789

Open
jnms-me wants to merge 2 commits into
dlang-community:masterfrom
jnms-me:importc
Open

Add ImportC support via dmd -H.#789
jnms-me wants to merge 2 commits into
dlang-community:masterfrom
jnms-me:importc

Conversation

@jnms-me

@jnms-me jnms-me commented Oct 26, 2025

Copy link
Copy Markdown

This adds .c, .h and .i files (see https://dlang.org/spec/importc.html) as 'alternative' (lower priority) importable files. $DMD or dmd is called on the source file with -H to produce a .di file, which we can parse as normal.
Note that .h files are only supported by current dmd master, since the merge of dlang/dmd#21692.

@github-actions

Copy link
Copy Markdown

Thanks for your Pull Request and making D better!

This comment will automatically be updated to summarize some statistics in a few minutes.

@jnms-me

jnms-me commented Oct 27, 2025

Copy link
Copy Markdown
Author

See Pure-D/serve-d#328.

@WebFreak001 WebFreak001 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

otherwise LGTM

import std.process : environment;

if ("DMD" in environment)
return environment["DMD"];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs to be documented in the README or other places where this might be relevant

@jnms-me

jnms-me commented Oct 27, 2025

Copy link
Copy Markdown
Author

Module auto-complete in serve-d doesn't seem to work yet. Any idea where that would be implemented?

@WebFreak001

Copy link
Copy Markdown
Member

you mean auto complete for this:

import some.mod|;

?

@jnms-me

jnms-me commented Oct 27, 2025

Copy link
Copy Markdown
Author

Yes, that doesn't show ImportC modules yet.

@bangbangsheshotmedown

Copy link
Copy Markdown

Damn i didn't see this PR, i think mine is better because it doesn't generate any file thus is faster

#798

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

Successfully merging this pull request may close these issues.

3 participants