1
我有一個非託管庫,我想從託管類中使用。該函數的接口是:C++/CLI管理VS. unmanaged short
GetProgress(short* value);
所以我在管理類中寫道:
short val = 0;
GetProgress(&val);
我得到了以下錯誤:
Error C2664: 'GetProgress' : cannot convert parameter 1 from 'cli::interior_ptr' in 'short *' with [ Type=short ]
我讀this topic,所以我改變了我代碼分成:
short val = 0;
pin_ptr<short*> pVal = &val;
GetProgress(pVal);
除了前面的錯誤,我得到
Error C2440: 'initialisation' : cannot convert from 'short *' to 'cli::pin_ptr' with [ Type=short * ]
我該如何解決這個問題?
好的就是這樣。謝謝! :) – gregseth 2012-02-29 10:48:50