typedef enum c header to C#
-
Hello, I have the problem that I have a lengthy c header file containing something like:
typedef enum { enum1, enum2, enum3, ... a lot more } MyEnums;
How can I best reuse this information in my CS projects without cut'n paste or even retype this? Thanks, Tobias -
Hello, I have the problem that I have a lengthy c header file containing something like:
typedef enum { enum1, enum2, enum3, ... a lot more } MyEnums;
How can I best reuse this information in my CS projects without cut'n paste or even retype this? Thanks, Tobiashi, two ideas: 1. write a little program to rework the source file or 2. compile as a C++/CLI dll, decompile with reflector towards C# source. (this will loose all comments, assuming you have them; not clear from your post). :)
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips: - before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use PRE tags to preserve formatting when showing multi-line code snippets
-
hi, two ideas: 1. write a little program to rework the source file or 2. compile as a C++/CLI dll, decompile with reflector towards C# source. (this will loose all comments, assuming you have them; not clear from your post). :)
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips: - before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use PRE tags to preserve formatting when showing multi-line code snippets
-
Thank you for your post, I allready tried the second solution, but didn't succeed. I didn't find the typedef enum in the reflected dll. Do you know how excactly I need to include the typedef? Tobias
You can't. typedef is a C keyword and not C#. As Luc said, you could use C/CLI to get this. Why can you not cut/paste this code?
Deja View - the feeling that you've seen this post before.
-
Hello, I have the problem that I have a lengthy c header file containing something like:
typedef enum { enum1, enum2, enum3, ... a lot more } MyEnums;
How can I best reuse this information in my CS projects without cut'n paste or even retype this? Thanks, TobiasHmmm.... as far as the enum is concerned; perhaps a RegEx to extract it and rewrite it in C# syntax? An interesting little project, I may have to try it.
-
Hello, I have the problem that I have a lengthy c header file containing something like:
typedef enum { enum1, enum2, enum3, ... a lot more } MyEnums;
How can I best reuse this information in my CS projects without cut'n paste or even retype this? Thanks, Tobias