digitalmars.D - A use-case for ImportC?
- WebFreak001 (5/5) Jun 07 2021 assuming you are writing a program in C - would the ImportC
- Zardoz (3/9) Jun 08 2021 For example, allows to use directly C single-header only libs,
- Basile B. (3/9) Jun 08 2021 I'd expect this to work using the ast formater residing in the
- Imperatorn (2/8) Jun 08 2021 That would be nice indeed
assuming you are writing a program in C - would the ImportC feature enable you to write headers in C (like in your existing codebase) and then import them for implementation in D? This would very neatly allow using D in C projects without duplicating the struct types, typedef, etc. in both C and D files.
Jun 07 2021
On Tuesday, 8 June 2021 at 06:56:40 UTC, WebFreak001 wrote:assuming you are writing a program in C - would the ImportC feature enable you to write headers in C (like in your existing codebase) and then import them for implementation in D? This would very neatly allow using D in C projects without duplicating the struct types, typedef, etc. in both C and D files.For example, allows to use directly C single-header only libs, like Nuklear : https://github.com/Immediate-Mode-UI/Nuklear
Jun 08 2021
On Tuesday, 8 June 2021 at 06:56:40 UTC, WebFreak001 wrote:assuming you are writing a program in C - would the ImportC feature enable you to write headers in C (like in your existing codebase) and then import them for implementation in D? This would very neatly allow using D in C projects without duplicating the struct types, typedef, etc. in both C and D files.I'd expect this to work using the ast formater residing in the dmd.hdrgen module.
Jun 08 2021
On Tuesday, 8 June 2021 at 06:56:40 UTC, WebFreak001 wrote:assuming you are writing a program in C - would the ImportC feature enable you to write headers in C (like in your existing codebase) and then import them for implementation in D? This would very neatly allow using D in C projects without duplicating the struct types, typedef, etc. in both C and D files.That would be nice indeed
Jun 08 2021