私はcで書かれたdllを使用しています。私は私のC#プログラムに必要なすべての機能をインポートしました。機能のほとんどは正しく動作することができますが、いくつかの問題を抱えています。私が問題を抱えている関数は、入力として構造体が必要です。私はC#でこの構造体を定義する必要があると想定していますが、これはやっていますが、私は自分自身を混乱させ始めているので、私は試行したものを残します。構造体にはかなり長いので、私はそれをC言語でのように見えるだけで何の意志である:dllからc structをc#に変換する
typedef struct chain_link_info
{
unsigned short command;
unsigned long* buff_id;
FLAGS_TYPES flags; // this is a union that i will list below
} CHAIN_LINK_INFO;
typedef union flags_type
{
unsigned long ulong;
struct
{
unsigned short std_flags;
unsigned short high
} ushort;
struct
{
unsigned int a : 1;
unsinged int b : 1;
unsinged int c : 1;
unsinged int d : 1;
unsinged int e : 2;
unsinged int f : 1;
unsinged int g : 1;
unsinged int h : 1;
unsinged int i : 1;
unsinged int j : 1;
unsinged int k : 1;
unsinged int l : 1;
unsinged int m : 1;
unsinged int n : 1;
unsinged int o : 1;
unsigned int high_word :16
} std_bits;
} FLAGS_TYPE;
C#でこれらstuctsを定義するための適切な方法は何ですか?
私はこれが[StructLayout](http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.structlayoutattribute.aspx)が再生するためには来るが、ポジティブ。 –
申し訳ありませんがdownvote、私はそれを削除しました。偶然にそれをクリックしている必要があります。私は、組合がどのようにマッピングされているのだろうか不思議です。 –