CameraPDK DllStart has null parameter in v4

SDK supports Prepar3D’s philosophy of an open development architecture and encourages third parties to bring new innovations with improved add-ons and training content.
Locked
michaelwiki
Posts: 10
Joined: Tue Apr 11, 2017 6:05 pm

CameraPDK DllStart has null parameter in v4

Post by michaelwiki »

With v4's new CameraPDK example I built the unmodified code VS 2015 and copied the Hybrid DLL to the ProgramData directory. I modified the add-on.xml and dll.xml. I can break into the DLLStart function with Visual Studio.

An exception is happening due to a null value being passed into the DLLStart function.

extern "C" __declspec(dllexport) void __stdcall DLLStart(__in __notnull IPdk* pPdk)

In the above call, the pPdk is null and results in a crash due to an Access Violation in the constructor of the PdkServices when it attempts the QueryService calls.

The similar, but different example from v3 works as expected, but the v4 interface using PDKServices interface does not.

Is this an bug in the new PDK interface or is there something else required to pass a valid IPdk ServiceProvider into DLLStart form Prepar3d v4?
michaelwiki
Posts: 10
Joined: Tue Apr 11, 2017 6:05 pm

[RESOLVED]: CameraPDK DllStart has null parameter in v4

Post by michaelwiki »

After further experimentation the CameraPDK works if I add it to the Add-In folder in the Documents folder. The exception only occurs when I try to add it directly in the Roaming folder. Perhaps I'm doing something wrong when doing that. The documentation states either way should work, but doesn't give a lot of details on the direct placement in the Roaming folder.

So the problem is solved for me. I suppose it's best practice to use the "%USERPROFILE%\Documents\Prepar3D v4 Add-ons" anyway.
Locked