Quick Sign In:  

Forum: VirtualDJ Plugins

Topic: Debugging c++ video effect - Page: 1
I'm writing a video effect and virtual dj keeps throwing an error saying it is not supported. I have tried injecting debugger wait code into the onLoad method but it doesn't even seem to be called. Is there another place earlier in the callstack I can inject as I'm not currently seeing any place I can hit a breakpoint to debug.
 

Posted Fri 01 Dec 23 @ 1:26 am
Have you checked that you have/use the last GUID, ie last VirtualDJ SDK version?

CLSID_VdjPlugin8 = { 0xED8A8D87, 0xF4F9, 0x4DCD, { 0xBD, 0x24, 0x29, 0x14, 0x12, 0xE9, 0x3B, 0x60 } }
IID_IVdjPluginVideoFx8 = { 0xbf1876aa, 0x3cbd, 0x404a, { 0xbe, 0xab, 0x5f, 0x8b, 0x51, 0xe3, 0x90, 0xc0 } }


HRESULT VDJ_API DllGetClassObject(const GUID &rclsid,const GUID &riid,void** ppObject)
{
// you can check here

if (memcmp(&rclsid,&CLSID_VdjPlugin8,sizeof(GUID))==0 && memcmp(&riid,&IID_IVdjPluginVideoFx8,sizeof(GUID))==0)
{
*ppObject = new YourPluginClass();

}
else
{
return CLASS_E_CLASSNOTAVAILABLE;
}

return NO_ERROR;
}
 

Yes I run that check, and they are the most up to date versions. However I can't even get the debugger to hit that function as an entrypoint before VDj throws the error.
 

 

Your entry point was renammed "DllGetClassObject1" in your sdk?
 

It was, and for the other plugins I’ve built it works fine. I believe it was due to some conflict with another windows library I was using. Nonetheless, if I use the other entry point function with the regular name it has the same result as well.
 

Still haven't found a solution, any recommendations on where to go from here?
 

Sorry for the delay

I succeeded to compile it



1) I came back to default definition for DllGetClassObject
2) Move
#include "VDJ/vdjVideo8.h"
at top, just after pragma
3) it looks TouchEngine produces then the error
 

Ok let me try that, I've been trying to go back to the default definition but get a compiler error.
 

Ok so now it compiles with the standard definition, but I still cant get the debugger to hit any breakpoints at all. Do you mind sharing the visual studio config you are using for debugging?
 

So I can see visual studio load the symbols when I import the plugin and I can see the breakpoints light up but even on the entrypoint function nothing is hit when the plugin loads. All I get is this window and no other errors.
After debug launch

Attempting to import plugin

After attempt to load
 

Start with basic code by setting comments to your aditional code and you will see it works. It's something with the lib loaded to my mind.
 

But shouldn't DLLGetClassObject be the first function called by VDJ? I don't even hit any of those breakpoints.
 

The output from the visual studio console is below, it seems to only load symbols before VDJ immediately kills the plugin.

'virtualdj.exe' (Win32): Loaded 'C:\Users\djevo1\AppData\Local\VirtualDJ\Plugins64\VideoEffect\VDJTouchEngine.dll'. Symbols loaded.
'virtualdj.exe' (Win32): Unloaded 'C:\Users\djevo1\AppData\Local\VirtualDJ\Plugins64\VideoEffect\VDJTouchEngine.dll'
 

user27599935 wrote :
But shouldn't DLLGetClassObject be the first function called by VDJ? I don't even hit any of those breakpoints.

Yes it is. As I said, your additional code make the plugin impossible to load.
Start again by only keeping vdj core sdk functions and you will see that it loads. Then add your code again step by step to find the issue.
 

I'll give it a try but from a software standpoint that doesn't make much sense, at the very least it should call the entrypoint function then fail to load. The only thing I could think of that could cause the issue is something with externally linked symbols breaking the virtualdj api which in that case it seems impossible to diagnose.
 

Since you seem to be linking to touchengine.lib, if that fails to load you would indeed not even reach dllgetclassobject
Perhaps this lib requires a dll to be present?
 

So I found the source of the issue. Bearing in mind the debugger still does not attach, but if I comment out the lines of code below it is able to load. It is only these lines that cause the issue, I'm a bit confused as that segment of code shouldn't run at all but maybe VDJ does some form of runtime check on these functions??? I'm at a loss but at least now I am able to load the plugin.

HRESULT VDJ_API VDJTouchEngine::OnDeviceClose() {

if (instance != nullptr)
{
//TEInstanceSuspend(instance);
//TEInstanceUnload(instance);
//TERelease(&TEInput);
//TERelease(&TEOutput);
//TERelease(&TEOutputTexture);
//TERelease(&instance);
instance = nullptr;
D3DContext = nullptr;
D3DDevice = nullptr;
}

return S_OK;
}

 

Adion wrote :
Since you seem to be linking to touchengine.lib, if that fails to load you would indeed not even reach dllgetclassobject
Perhaps this lib requires a dll to be present?


Yup, that's exactly what it is hahahahaha. I wish VDJ gave a clearer error when this was the case.
 

So if I run with a debugger it works as expected, but if I run VDJ without the debugger connected it starts showing the error again. I can confirm everything works when VDJ is launched through the debugger. This happens bpth with Debug and Release builds.
 

80%