をしようとしたとき、私はdocumentationから(次のAlsa関数にDLLIMPORTを呼び出そう:P /呼び出しEntryPointNotFoundExceptionポインタのコンテナを割り当てる
上snd_seq_client_info_t コンテナを割り当てます#define snd_seq_client_info_alloca(ptr) __snd_alloca(ptr, snd_seq_client_info)
スタック
ここでは、私がモノで達成したいのと同様のapplicationのコードを読んでいる間にC++で見つかった実装を示します:
snd_seq_client_info_t* cinfo;
snd_seq_client_info_alloca(&cinfo);
そして、ここで私がこれまで持っているものですが、それが動作していません。
[DllImport(libasound.so.2)]
private static extern void snd_seq_client_info_alloca(out IntPtr ptr);
internal static void MyFunction()
{
IntPtr clientInfo = IntPtr.Zero;
snd_seq_client_info_alloca(out clientInfo);
// and then some more ...
}
しかし、私は次の例外を取得:
System.EntryPointNotFoundException: snd_seq_client_info_alloca
at (wrapper managed-to-native)
MonoMultiJack.ConnectionWrapper.Alsa.LibAsoundWrapper:snd_seq_client_info_alloca (intptr&)
'EntryPointNotFoundException'と' #define'です。 D'oh、時には見知らぬ人を見過ごすこともある。ありがとう。少なくとも今コンパイルすると、割り当てるメモリのサイズのライブラリコードを検索するだけです。 – Residuum
実際にC#からstackallocを実行したい場合は、次のようにstackallocキーワードを使用することもできます。int * block = stackalloc int [100]; –