View Full Version : PluginPath unhandled win32 exception
Astralp
03-07-2010, 08:02 PM
Is anyone using this successfully on windows? This is a major stumbling block, upon further investigation I've discovered that the underlying win function getModuleFileName() is the cause of the crash, I've tried implementing my own function with it. I've spent hours now trying to figure out what the problem is, it seems like it isn't a valid dll in some way. I've also tried getting the plugin module handle and passing that in, but it makes no difference. Any ideas appreciated, or at the very least an 'It works for me'
WDL_String* path;
pGraphics->PluginPath(path);
string globalFilePath = path->Get();
UPDATE: I've now also tried with a clean copy of IPlug and the example project, and that causes a poof when the PluginPath is run... I hope I'm missing something simple.
Andy
Astralp
03-07-2010, 09:58 PM
Irrelevant panicking deleted...
Xenakios
03-08-2010, 12:52 AM
WDL_String* path;
pGraphics->PluginPath(path);
string globalFilePath = path->Get();
You are using an uninitialized pointer *path here. Whatever you may have done and has appeared to work will not really work, it's been pure chance if the code has appeared to run without crashing. You might want to read up on C++ basics, pointers, memory allocation and deallocation etc.
The implementation in IPlug of the PluginPath function is :
void IGraphicsWin::PluginPath(WDL_String* pPath)
{
GetModulePath(mHInstance, pPath);
}
Which does not allocate memory for the path WDL_String, you have to do it yourself, also cleaning up the string later.
WDL_String* path=new WDL_String;
...do stuff with *path...
delete path;
This may also be an error, but I am not sure, it's been months since I've last used the C++ stl strings.
string globalFilePath = path->Get();
Astralp
03-08-2010, 06:48 AM
Oh my God, now i feel stupid, I thought I was long beyond that type of error... Stumbled by a pointer...
Thanks so much Xenakios!
RRokkenAudio
03-08-2010, 06:56 AM
I suggest you take a peek at some tutorials, heres a good one:
http://www.hitmill.com/programming/cpp/helloWorld.htm
hehehe j/k, yeah that sucks lol,
~Rob.
Astralp
03-08-2010, 06:59 AM
hahaha, thanks Rob I will do as soon as I've learned how to brush my teeth.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.