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

Action to generate .di header file from a .c file using ImportC #906

Open
SingingBush opened this issue Oct 26, 2023 · 4 comments
Open

Action to generate .di header file from a .c file using ImportC #906

SingingBush opened this issue Oct 26, 2023 · 4 comments

Comments

@SingingBush
Copy link
Member

SingingBush commented Oct 26, 2023

As discussed in this forum thread https://forum.dlang.org/post/ugvc3o$5t3$1@digitalmars.com, dmd can generate di files (essentially D header files) from C code:

dmd -c test.c -Hf=test.di

It would be great (and reasonably straight forward) to have an action available when right-clicking on a *.c file that prompts the user for a destination output (defaulting to same file name but with .di extension in same directory) then attempts to use dmd based on the syntax above.

  • Without dmd (or potentially ldc) configured the option should be visible in the context menu but not enabled.
  • This is currently dmd (ldc should work soon) only! There is an issue running this with gdc
  • There will need to be a good level of error handling and the terminal output should probably be made visible to the user.
@rikkimax
Copy link
Contributor

This should work for ldc in next release, same as dmd, changes are in ~master that allow it to work (with bugs yet to be found).

@rikkimax
Copy link
Contributor

In saying that, this probably won't do what you want it to. You'd be missing any include paths ext. and for Windows we still haven't solved the whole needing the VS vars to be loaded in.

Basically, fully self-contained files might work, but that's about it.

@SingingBush
Copy link
Member Author

understood. it'll be limited but I think it's worth getting some initial support in for this feature and work through pitfalls over time. Managing user expectations will be important so the UI will need to indicate limitations somehow.

@rikkimax
Copy link
Contributor

Yes, it's a happy accident that it works even in the simplest of cases. The main thing here is that us going into it must keep it described as limited. Otherwise, people are gonna be unhappy!

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

No branches or pull requests

2 participants