Page 1 of 1

Problem with LoadLibrary_ from an include file ?!

Posted: Fri Feb 13, 2009 11:36 pm
by kawasaki
Hey,

I'm creating a plugin system where as plugin files (DLL's) are loaded using LoadLibrary_().

Now heres the problem;

When I use the LoadLibrary in the main source code file, it works ok, everything runs fine, meaning 4 hours of coding pays off. But when its called in an included file for purpose that the plugin manager source (that contains the call) is huge, and It would be very messy having it all pasted at the top of the main file, the call fails.. It retuns 0, and Error 998 is returned from GetLastError_().

I've tried both IncludeFile & XIncludeFile.


Error 998 : Invalid access to memory location. (ERROR_NOACCESS).


Anyone have the faintest of ideas?

Thanks


P.S. Using Windows Vista 32bit.. I'm going to run it on my XP VMachine now and see if I get the same problems.

Posted: Sat Feb 14, 2009 12:26 am
by Mistrel
Just out of curiosity, did you try OpenLibrary?

Posted: Sat Feb 14, 2009 12:33 am
by kawasaki
OpenLibrary does the same...



This seems to only be present on Vista, since I am running it on my Windows XP virtual machine, and it's working absolutely fine.. Which kind of irritates me lol..

Posted: Sat Feb 14, 2009 12:38 am
by srod
Error code 998 is a 'no access' error.

I take it that it works if you just quickly knock up a very small test program and try and open the dll from an include file etc?

Posted: Sat Feb 14, 2009 12:39 am
by kawasaki
When testing the function in an include file, it does work;

however, as stated in the previous post, this problem is Vista specific. It runs fine on XP.


I don't understand how this problem exists anyway, assuming IncludeFile or XIncludeFile just directs the compiler to take the contents of the included file and put them in place of the command.

Posted: Sat Feb 14, 2009 1:00 am
by kawasaki
Right, it's established that the error occurs to DLL's with a string list..

Why? I have no idea.


Thanks guys

Posted: Sat Feb 14, 2009 1:09 am
by srod
What do you mean by a string list? Do you mean a linked list of strings?

Posted: Sat Feb 14, 2009 2:09 am
by kawasaki
Sorry, StringTable as an included Resource.. My mind was going 1000mph when I wrote that lol.


Providing the DLL's don't have a StringTable resource, the program runs fine.

Posted: Sat Feb 14, 2009 2:58 am
by Mistrel
Can you provide a reproducible sample?

Posted: Sat Feb 14, 2009 10:57 am
by srod
Well, I have written a very large dll which utilises a resource file with a very large string table. I use this dll in various programs without a problem. Admittedly my programs link to the dll via an import library etc. rather than using OpenLibrary() etc.

It is a strange problem you describe. Is it the actual OpenLibrary() / LoadLibrary_() command which is reporting the error?

Posted: Sat Feb 14, 2009 8:50 pm
by Mistrel
PureGDK uses OpenLibrary in many, many files and across includes. I can't say that I've ever had this problem.

Are you compiling just with PB or are you using anything special (TailBite, PureGDK, etc)?

Posted: Sun Feb 15, 2009 12:28 am
by kawasaki
srod wrote:Well, I have written a very large dll which utilises a resource file with a very large string table. I use this dll in various programs without a problem. Admittedly my programs link to the dll via an import library etc. rather than using OpenLibrary() etc.

It is a strange problem you describe. Is it the actual OpenLibrary() / LoadLibrary_() command which is reporting the error?

It was purely using LoadLibrary_() with LoadString_() aftewards.. Why it didnt want to to work with my project is not known, but i've resolved the error now by working out a way to send information to the main application via the plugin dll without using the Stringtable...