这是C#代码.
namespace CameraTest
{
class Program
{
static void Main(string[] args)
{
string[] lst = new string[10];
for (int i = 0; i < 10; i++)
{
lst[i] = new string(' ', 33);
}
bool sync = true;
bool ret = CameraCalls.CAM_EnumCameraEx(sync, lst, 10, 33);
}
}
public static class CameraCalls
{
[DllImport("CamDriver64.dll")]
public static extern bool CAM_EnumCameraEx(bool sync,
[MarshalAs(UnmanagedType.LPArray)]
string[] lst,
long maxCam,
long maxChar);
}
}
Run Code Online (Sandbox Code Playgroud)
非托管方法就是这样.
BOOL WINAPI CAM_EnumCameraEx(BOOL bSynchronized, char **ppCameraList, long lMaxCamera, long lMaxCharacter);
Run Code Online (Sandbox Code Playgroud)
该方法写入传入的字符串数组.有没有办法从c#调用此方法并让非托管代码能够写入字符串数组?
我的问题似乎是 Visual Studio 正在尝试导入不应该导入的模块。这是我收到的错误。我正在尝试使用 Visual Studio 设置 Webpack。webpack 构建工作正常。Visual Studio TypeScript 构建失败。
Severity Code Description Project File Line Suppression State
Error TS2792 Build:Cannot find module '.'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? Nester.MvcUI C:\...\MvcUI\node_modules\@types\webpack-sources\lib\CachedSource.d.ts 3
Error TS2792 Build:Cannot find module '.'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option? Nester.MvcUI C:\...\MvcUI\node_modules\@types\webpack-sources\lib\CompatSource.d.ts 1
Error TS2792 Build:Cannot find module '.'. …Run Code Online (Sandbox Code Playgroud) javascript typescript webpack asp.net-core visual-studio-2019