问c#调用dll的有关问题(请Knight94(愚翁)、kssys和看看 )

问c#调用dll的问题(请Knight94(愚翁)、kssys和各位高手看看 )
我需要用c#调用一个dll文件,这个dll文件是用VC写的,具体的功能就是传入一个字符串后,输出一个字符串,而且传入的和返回的定义类型都是char*,c#里我调用dll的代码是这样写的:
public   class   TransferDll
{
[DllImpor( "GetString.DLL ",EntryPoint= "GetCString ",CallingConvention=CallingConvention.Winapi)]
public   static   extern   StringBuilder     GetCString(StringBuilder   InuptString);
}
  调用dll里面的函数是这样写的:
.........
.........
string   strTest   =   null;
StringBuilder   test   =   new   StringBuilder();
       
StringBuilder   testwo   =   new   StringBuilder();

testwo.Append( "磁盘驱动器 ");
testwo.Append( '/ ');
test=   TransferDll.GetCString(testwo);
strTest   =   test.ToString();
........
........
但是我编译的时候,老是报未将对象引用设置到对象的实例的错误。
我昨天看了半天,也没看出来是怎么回事,
各位高手看看,到底是怎么回事,

------解决方案--------------------
如果只是传进的话,你可以如下试试
public class TransferDll
{
[DllImpor( "GetString.DLL ",EntryPoint= "GetCString ")]
public static extern string GetCString( string InuptString);
}
------解决方案--------------------
试试这2个
DllImpor( "GetString.DLL ",EntryPoint= "GetCString ")]
public static extern string GetCString( ref string InuptString);

DllImpor( "GetString.DLL ",EntryPoint= "GetCString ")]
public static extern string GetCString(ref StringBuilder InuptString);
用IntPtr 是错误的
------解决方案--------------------
UP`