C로 짜인 라이브러리를 C#에서 호출하도록 작업하다가, 안 풀리는 문제가 있어 이곳에서 조언을 구하고 싶습니다.
// 먼저, 소스코드입니다.
using System;
using System.Runtime.InteropServices;
namespace Dialogic.Voice
{
public struct DX_CAP // Call Analysis Parameters
{
public ushort ca_nbrdna; /* # of rings before no answer. */
public ushort ca_stdely; /* Delay after dialing before analysis. */
public ushort ca_cnosig; /* Duration of no signal time out delay. */
};
public static class Dx
{
[DllImport("libdxxmt", EntryPoint = "dx_dial",
CallingConvention = CallingConvention.Cdecl)]
public static extern int Dial(int channel_device, string number,
ref DX_CAP cap, int mode);
}
}
Dial 함수의 세번째 인수를 다음과 같이 넘기면 아무런 문제없이 제대로 작동합니다만,
DX_CAP cap = new DX_CAP();
Dx.Dial(1, "025552222", cap, 1);
그런데 C의 dx_dial 함수는 세번째 인수로 NULL 포인터를 받을 수 있게도 되어 있어서요, 위의 cap 인수 대신에 NULL Pointer를 넘기는 효과를 얻고 싶으면 어떻게 해야 할까요?