• Advertisement
Sign in to follow this  

depentant plugs

This topic is 2090 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i have an application i have wrote in vs2k5 native cpp. Im now ready to move my code into plugins that depend on other plugins. I can get the app to compile and link without any errors. but when i go to run the app it always says i it cant find the depentant plugin. its missing from your computer, please reinstall.... I have all the dll and plugins in there own build directories. I have tried putting all the plugins and dll together in the same directory but it doesnt do any good.

i remove all references of plugin4 from the solution everything seems to run smoothly.

here is my dll and plugin stucture
Main.dll
- > Plugin1 ( it cant find this one )
- - > Plugin4 ( this is the one that causes the problem)
- > Plugin2
- > Plugin3


any body any idea what i need to do get this to run. any help would be greatly appreciated

Share this post


Link to post
Share on other sites
Advertisement
You'd need to provide significantly more information about your app and your plugin useful help.

Your call to LoadLibrary() can specify the full path and give you a module handle, if it works then GetProcAddress() with the module handle to get your plugin's instance information. If that works, call the functions. That formula has worked well for many thousands of developers.

The second formula is to go the COM route where the object gets installed, you query to get an object handle, call functions on that object, and you release it when done. This formula has also worked well for many thousands of developers; most people who develop games don't even recognize COM when they start using Direct3D.


Why one module may be corrupting your system would require intimate knowledge of your system. You'd probably end up needing to post the whole thing and all the files involved to a paste site, and pray somebody has the time and ability to review your code.

Share this post


Link to post
Share on other sites
thank u frob for the responce back

the thing is that the application is not even get loaded, does not even step into the main(). Which makes me thinks in in the project settings some where.

'MyApp.exe': Loaded 'D:\Sandbox\Simulator\bin\Debug\MyApp.exe', Symbols loaded.
'MyApp.exe': Loaded 'C:\Windows\System32\ntdll.dll', No symbols loaded.
'MyApp.exe': Loaded 'C:\Windows\System32\kernel32.dll', No symbols loaded.
'MyApp.exe': Loaded 'C:\Windows\System32\KernelBase.dll', No symbols loaded.
it dies here,
if i remove the problem plugin the next line is the base dll, and it loads just fine




the code

int DLLFileEntry::MapIn(void) { // only allowed if not mapped in and usage count == 0
_ASSERT( myLibHandle == NULL );
SafeString completepath = GetCompletePath();
_ASSERT( completepath.Data() != NULL);
_ASSERT( myRefCount == 0 );
_ASSERT( myMapped_In == false );
SetLastError(ERROR_SUCCESS);
myLibHandle = ::LoadLibrary( completepath.Data() );// address of filename of executable module
DWORD error = GetLastError();
if (myLibHandle == NULL) {
if (error == ERROR_SUCCESS) {
return -1;
}
return error;
}
if (error != ERROR_SUCCESS) {
_ASSERT(NULL); // mapped in, but error ? (happens when using purify!)
SetLastError(ERROR_SUCCESS);
}
myMapped_In = true;
return ERROR_SUCCESS;
}

int DLLFileEntry::MapOut(void) // only allowed if mapped in and usage count == 0
{
_ASSERT( myLibHandle != NULL );
_ASSERT( myRefCount == 0 );
_ASSERT( myMapped_In == true );
SetLastError(ERROR_SUCCESS);
BOOL Answer = ::FreeLibrary( myLibHandle
// handle to loaded library module
);
myFuncAddresses.Dispose();
if (Answer == FALSE)
{
DWORD error = GetLastError();
if (error == ERROR_SUCCESS)
{
return -1;
}
return error;
}
myMapped_In = false;
myLibHandle = NULL;
return ERROR_SUCCESS;
}

bool DLLFileEntry::CheckAndStoreFuncs(void) {// checks the function names

_ASSERT( myLibHandle != NULL );
_ASSERT( myRefCount == 0 );
_ASSERT( myMapped_In == true );
if ( myFuncNames == NULL )
{
_ASSERT(NULL);
return false;
}
unsigned int nrfuncs = myFuncNames->GetSize();
SetLastError(ERROR_SUCCESS);
for (unsigned int teller = 0; teller < nrfuncs; teller++)
{
SafeString theFuncName = (*myFuncNames)[teller];
char *ansi = (char *)theFuncName.ToAnsi();
FARPROC theFuncAddress = GetProcAddress( myLibHandle, // handle to DLL module
ansi); // name of function

//SAFE_DELETE( ansi );
if (theFuncAddress == NULL) {
myFuncAddresses.Dispose();
DWORD error = GetLastError();
myDLLisOK = false;
return false;
}
//TreeElement<FARPROC>* TeFunc = myFuncAddresses.AddRoot(theFuncName);
//_ASSERT(TeFunc != NULL);
//TeFunc->SetData(theFuncAddress);
this->myFuncAddresses.Add(new DLLHelperData(theFuncName, theFuncAddress) );
myDLLisOK = true;
}
return true; // success
}
FARPROC DLLFileEntry::GetFuncAddress(SafeString funcname)
{
_ASSERT( myLibHandle != NULL );
_ASSERT( myMapped_In == true );
if (funcname == NULL) {
_ASSERT(NULL);
return NULL;
}
//TreeElement<FARPROC>* TeToSearch = myFuncAddresses.Search(funcname);
//if (TeToSearch) {
// return TeToSearch->GetData();
//}
DLLHelperData *phd = myFuncAddresses.Search(funcname);
if ( phd )
return phd->FarProc();

return NULL;
}
void DLLFileEntry::SetFuncNameList(StringList* theFuncNames) {
//myFuncNames = theFuncNames;
if ( myFuncNames ) {
myFuncNames->RemoveAll();
delete myFuncNames;
myFuncNames = NULL;
} // if ( myFuncNames && myFuncNames->RemoveAll() )

int c = theFuncNames->GetSize();
myFuncNames = new StringList();
for (int i = 0;i<c;i++)
myFuncNames->Add( theFuncNames->GetAt(i));
}
[/quote]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement