Problem with LoadLibrary_ from an include file ?!

Everything else that doesn't fall into one of the other PB categories.
kawasaki
Enthusiast
Enthusiast
Posts: 182
Joined: Thu Oct 16, 2003 8:09 pm

Problem with LoadLibrary_ from an include file ?!

Post 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.
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post by Mistrel »

Just out of curiosity, did you try OpenLibrary?
kawasaki
Enthusiast
Enthusiast
Posts: 182
Joined: Thu Oct 16, 2003 8:09 pm

Post 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..
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post 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?
I may look like a mule, but I'm not a complete ass.
kawasaki
Enthusiast
Enthusiast
Posts: 182
Joined: Thu Oct 16, 2003 8:09 pm

Post 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.
kawasaki
Enthusiast
Enthusiast
Posts: 182
Joined: Thu Oct 16, 2003 8:09 pm

Post by kawasaki »

Right, it's established that the error occurs to DLL's with a string list..

Why? I have no idea.


Thanks guys
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

What do you mean by a string list? Do you mean a linked list of strings?
I may look like a mule, but I'm not a complete ass.
kawasaki
Enthusiast
Enthusiast
Posts: 182
Joined: Thu Oct 16, 2003 8:09 pm

Post 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.
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post by Mistrel »

Can you provide a reproducible sample?
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post 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?
I may look like a mule, but I'm not a complete ass.
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post 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)?
kawasaki
Enthusiast
Enthusiast
Posts: 182
Joined: Thu Oct 16, 2003 8:09 pm

Post 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...
Post Reply