Is it possible to use Sony Camera Remote SDK from a C# project?

2 weeks ago 8
ARTICLE AD BOX

I’m using the Sony Camera Remote SDK (Windows) in a project with C#.

Sony’s sample app (RemoteCli) works and successfully connects to the camera.

In C#, I’ve successfully called simple functions like:

GetSDKVersion

Init

Release

However, I’m having trouble with SDK functions that use pointers to C++ classes like EnumCameraObjects .

Is it officially supported (or technically possible) to use the Sony Camera Remote SDK directly from a C# project via P/Invoke?
Or does it require writing a C++/CLI wrapper or native C++ bridge layer?

Has anyone successfully connected to a Sony camera from a pure C# project using this SDK? so

It's a native C++ DLL (Cr_Core.dll)

It exposes C-style exports callable via P/Invoke

Init() and GetSDKVersion() work fine from C#

Only EnumCameraObjects() fails with 0x8703 (CrError_Adaptor)

All DLLs load successfully including CrAdapter\Cr_PTP_USB.dll

The exact same code works perfectly from native C++

Camera connects fine via both USB and WiFi in C++

static void RunSDK() { Console.WriteLine("=== C# Sony Camera SDK Test ===\n");

string dllPath = @"..\CrSDK_v2.01.00_20260203a_Win64\RemoteCli\build\Debug"; string adapterPath = dllPath + @"\CrAdapter"; // Tell Windows to search BOTH folders for DLLs SetDllDirectory(dllPath); AddDllDirectory(dllPath); AddDllDirectory(adapterPath); Environment.CurrentDirectory = dllPath; Console.WriteLine("Checking DLL loading:"); // Root DLLs LoadAndCheck(dllPath + @"\Cr_Core.dll"); LoadAndCheck(dllPath + @"\monitor_protocol.dll"); LoadAndCheck(dllPath + @"\monitor_protocol_pf.dll"); // CrAdapter DLLs — preload them explicitly so SDK finds them LoadAndCheck(adapterPath + @"\libusb-1.0.dll"); LoadAndCheck(adapterPath + @"\libssh2.dll"); LoadAndCheck(adapterPath + @"\Cr_PTP_USB.dll"); LoadAndCheck(adapterPath + @"\Cr_PTP_IP.dll"); Console.WriteLine(); Console.WriteLine("Initializing COM (MTA)..."); int comResult = CoInitializeEx(IntPtr.Zero, COINIT_MULTITHREADED); Console.WriteLine($"COM result: 0x{comResult:X8}\n"); uint version = GetSDKVersion(); int major = (int)((version & 0xFF000000) >> 24); int minor = (int)((version & 0x00FF0000) >> 16); int patch = (int)((version & 0x0000FF00) >> 8); Console.WriteLine($"SDK Version: {major}.{minor}.{patch:D2}\n"); Console.WriteLine("Initializing SDK..."); bool initResult = Init(0); if (!initResult) { Console.WriteLine("ERROR: SDK Init failed."); CoUninitialize(); Console.ReadKey(); return; } Console.WriteLine("SDK initialized OK\n"); IntPtr cameraList = IntPtr.Zero; uint enumStatus = 0; int maxRetries = 10; for (int i = 0; i < maxRetries; i++) { Console.WriteLine($"Attempt {i + 1}/{maxRetries} — waiting 2s..."); Thread.Sleep(2000); cameraList = IntPtr.Zero; enumStatus = EnumCameraObjects(out cameraList); Console.WriteLine($"Status: 0x{enumStatus:X4}"); if (enumStatus == CrError_None && cameraList != IntPtr.Zero) { Console.WriteLine("SUCCESS!\n"); break; } } if (enumStatus != CrError_None || cameraList == IntPtr.Zero) { Console.WriteLine($"\nFAILED. Last error: 0x{enumStatus:X4}"); } Release(); CoUninitialize(); Console.WriteLine("\nPress any key to exit..."); Console.ReadKey();

} Console screen

Here is the actual SDK function signature from the header:

extern "C" SCRSDK_API CrError EnumCameraObjects( ICrEnumCameraObjectInfo** ppEnumCameraObjectInfo, CrInt8u timeInSec = 3 );

The function is exported with extern "C", but it returns a pointer to a pointer to a C++ interface (ICrEnumCameraObjectInfo**).

ICrEnumCameraObjectInfo is a C++ class with virtual methods (an interface).

Read Entire Article