COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :
Old 08-28-2013, 05:51 AM   #1
AndreZ
Human being with feelings
 
Join Date: May 2013
Posts: 18
Default Plugin wont open in host!

Hi there! My plugin builds fine, but doesnt appear when i drag it into vsthost. When i debug it i get this error:

First-chance exception at 0x66810583 (ISTest.dll) in vsthost.exe: 0xC0000005: Access violation reading location 0x00000000.
First-chance exception at 0x7613c41f in vsthost.exe: Microsoft C++ exception: CSEHException at memory location 0x00170bc4..

I googled this error and it seems to be a pointer or something that isnt initialized..

Have you got any tips at how i can debug this effectively? I have no idea where to start in the code, so i really just need a way of systematically trying things out to find the problem. How would you do it?

Thanks!
AndreZ is offline   Reply With Quote
Old 08-28-2013, 07:52 PM   #2
bozmillar
Human being with feelings
 
bozmillar's Avatar
 
Join Date: Sep 2009
Posts: 623
Default

I'd compile a debug version and step through it to see what causes it to crash.
bozmillar is offline   Reply With Quote
Old 08-29-2013, 02:19 AM   #3
AndreZ
Human being with feelings
 
Join Date: May 2013
Posts: 18
Default

But thats what i did and thats the error message i get.... I just dont know what to do from here. The error is nothing like a syntax error, where it just says "oh yeah you forgot to close a bracket there at line xy"
AndreZ is offline   Reply With Quote
Old 08-29-2013, 02:27 AM   #4
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

Quote:
Originally Posted by AndreZ View Post
But thats what i did and thats the error message i get.... I just dont know what to do from here. The error is nothing like a syntax error, where it just says "oh yeah you forgot to close a bracket there at line xy"
It's not enough to just build your plugin in debug mode. You need to run the plugin so that the VST host itself runs under the debugger. Some hosts will not like you doing that, but I doubt the freeware VSTHost (this one, right? http://www.hermannseib.com/english/vsthost.htm) would have any problems with that.
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
Xenakios is offline   Reply With Quote
Old 08-29-2013, 03:21 AM   #5
AndreZ
Human being with feelings
 
Join Date: May 2013
Posts: 18
Default

So how do i do it correctly? Currently im just attaching vsthost to the debugger in visual studio, loading the .dll into vsthost and having a look at the output window in VS. Is this not correct? Sorry if these questions seem stupid to you
AndreZ is offline   Reply With Quote
Old 08-29-2013, 03:59 AM   #6
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

Quote:
Originally Posted by AndreZ View Post
So how do i do it correctly? Currently im just attaching vsthost to the debugger in visual studio, loading the .dll into vsthost and having a look at the output window in VS. Is this not correct? Sorry if these questions seem stupid to you
Well, that should be the correct way to do it. If the debugger doesn't launch when the plugin crashes (the host application should crash together with it) and show the stack trace, it will indeed be a very tricky thing to debug...However since the generic error message you get is an access violation, you should carefully check all of your pointer and array related code. You could also try another host such as Reaper under the debugger, that might make the debugger work better.
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
Xenakios is offline   Reply With Quote
Old 08-29-2013, 04:56 AM   #7
AndreZ
Human being with feelings
 
Join Date: May 2013
Posts: 18
Default

The debugger doesnt crash, the plugin just doesnt load. I was hoping not to have to go through all the code again

What could this be? A pointer that isnt initialized? Or one that is pointing to nothing? Im guessing its something like that...

Thanks anyway for the help!
AndreZ is offline   Reply With Quote
Old 08-29-2013, 05:16 AM   #8
random_id
Human being with feelings
 
random_id's Avatar
 
Join Date: May 2012
Location: PA, USA
Posts: 356
Default

You could always try inserting breakpoints in the code to pinpoint where the error is occurring. If the debugger stops at one of the breakpoints, then you know that the variables, pointers, etc. are good until that point. It is a lot of trial and error, but you should be able to narrow down where the error is occurring.

If it still crashes, you might want to try compiling and testing one of the example projects to make sure it isn't an error with your setup.

I don't know, but I am just throwing out some ideas that hopefully will help.
__________________
Website: LVC-Audio
random_id is offline   Reply With Quote
Old 08-29-2013, 07:22 AM   #9
AndreZ
Human being with feelings
 
Join Date: May 2013
Posts: 18
Default

Its not the setup, i already checked with another project

Breakpoints are a good idea. I'll give that a go thanks.
AndreZ is offline   Reply With Quote
Old 08-29-2013, 02:37 PM   #10
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,645
Default

Another option is to download DebugView, and call OutputDebugString("meh") in your plug-in's constructor, before anything else. If you see "meh" appear in DebugView before the error, then you know your plug-in at least began loading. Then you move OutputDebugString("meh") down a bit and try again, until "meh" does not appear in DebugView anymore. Then you will have found the offending code.

Just to make sure: You do know for a fact that you can drag VST DLLs into VSTHost? Because I have never tried that myself, I always just choose "New plug-in..." from one of the menus.
Tale is offline   Reply With Quote
Old 08-30-2013, 06:51 AM   #11
AndreZ
Human being with feelings
 
Join Date: May 2013
Posts: 18
Default

Quote:
Originally Posted by Tale View Post
Another option is to download DebugView, and call OutputDebugString("meh") in your plug-in's constructor, before anything else. If you see "meh" appear in DebugView before the error, then you know your plug-in at least began loading. Then you move OutputDebugString("meh") down a bit and try again, until "meh" does not appear in DebugView anymore. Then you will have found the offending code.

Just to make sure: You do know for a fact that you can drag VST DLLs into VSTHost? Because I have never tried that myself, I always just choose "New plug-in..." from one of the menus.
Really good idea! Im trying this out now. Yes you can just drag plugins into vsthost to open them
AndreZ is offline   Reply With Quote
Old 08-30-2013, 07:13 AM   #12
AndreZ
Human being with feelings
 
Join Date: May 2013
Posts: 18
Default

I cant get the message to display even on a plugin thats loading correctly, and i've set the program to capture everything.... I just run DebugView and while im in debug mode in VS, it should output the message, right?
AndreZ is offline   Reply With Quote
Old 08-30-2013, 12:36 PM   #13
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,645
Default

The nice things about DebugView is that you don't even have to do a debug build of your plug-in, it will work just as well in a release build. You just start DebugView, and then load your plug-in in the host of your choice. Everything you output using OutputDebugString() will appear in the DebugView window.
Tale is offline   Reply With Quote
Old 08-30-2013, 12:47 PM   #14
olilarkin
Human being with feelings
 
Join Date: Apr 2009
Location: Berlin, Germany
Posts: 1,248
Default

if you are using WDL-OL you can use the macro DBGMSG("my debug message") which is a wrapper for OutputDebugString() on windows. it just calls printf on osx
__________________
VirtualCZ | Endless Series | iPlug2 | Linkedin | Facebook
olilarkin is offline   Reply With Quote
Old 09-01-2013, 02:29 PM   #15
olilarkin
Human being with feelings
 
Join Date: Apr 2009
Location: Berlin, Germany
Posts: 1,248
Default

i expect the problem is todo with a resource not being loaded correctly. Check resource.h and MyPlugin.rc . This issue has been discussed a few times on the forum
__________________
VirtualCZ | Endless Series | iPlug2 | Linkedin | Facebook
olilarkin is offline   Reply With Quote
Old 09-02-2013, 04:28 AM   #16
AndreZ
Human being with feelings
 
Join Date: May 2013
Posts: 18
Default

Quote:
Originally Posted by olilarkin View Post
i expect the problem is todo with a resource not being loaded correctly. Check resource.h and MyPlugin.rc . This issue has been discussed a few times on the forum
I used your python script to create the project and havent touched those two files, so i dont think its that... Thanks for the macro, i will try that.

Edit: I tried it, and it seems im not getting to the message, even if its in the plugins constructor. Can you identify the problem, or point me in the right direction? Just to be sure, i put the message under the TRACE in the constructor. That should show up, right?

Last edited by AndreZ; 09-02-2013 at 04:34 AM.
AndreZ is offline   Reply With Quote
Old 09-02-2013, 11:55 AM   #17
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,645
Default

Yeah, it should.

What should happen is that the host loads your DLL, at which time DllMain() (in WDL/IPlug/IPlug_include_in_plug_src.h) is called. Then the host will call VSTPluginMain(), which creates an instance of your plug-in and thus calls your constructor. If all that doesn't happen, then perhaps your build configuration is wrong, e.g. you haven't defined VST_API. Or you are not including WDL/IPlug/IPlug_include_in_plug_src.h...
Tale is offline   Reply With Quote
Old 09-03-2013, 05:26 AM   #18
AndreZ
Human being with feelings
 
Join Date: May 2013
Posts: 18
Default

Quote:
Originally Posted by Tale View Post
you haven't defined VST_API. Or you are not including WDL/IPlug/IPlug_include_in_plug_src.h...
IPlug_include_in_plug_src.h is included in the project and i used Oli's script to create the project and havent fiddled with the settings as far as i'm aware.

I'm totally lost The weird thing is that i dont get any error messages when i compile that i should get if it can't find a file or something isn't defined. It compiles without any errors, it just doesnt load in a host...
AndreZ is offline   Reply With Quote
Old 09-03-2013, 05:34 AM   #19
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,645
Default

Quote:
Originally Posted by AndreZ View Post
I'm totally lost The weird thing is that i dont get any error messages when i compile that i should get if it can't find a file or something isn't defined. It compiles without any errors, it just doesnt load in a host...
You could PM or e-mail me the DLL, so I can have a quick look.
Tale is offline   Reply With Quote
Old 09-22-2014, 10:53 PM   #20
1eqinfinity
Human being with feelings
 
Join Date: Apr 2014
Posts: 84
Default

I got the same problem when I started to use pointers inaccurately.
1eqinfinity is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 06:27 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.