DLL is not loaded

Posted By: PadMalcom

DLL is not loaded - 02/08/15 14:22

Dear developers, I have a strange behavior that my engine plugin DLLs are not loaded after a fresh installation of GS Pro 8.45. Neither wenn I put the DLL directly in the project folder nor when I put it into the acknex_plugins folder in the GStudio8 root folder.

All other plugins that are installed by default get loaded correctly (and also disappear when I temporarily remove them).

Any idea how to fix this?

P.S. The DLLs I tested definitely were recognized and worked in former days.
Posted By: Wjbender

Re: DLL is not loaded - 02/08/15 15:06

check to see if you have visual studio runtime installed , same year I think as you dll projects were ..

if I understood correct. .

jb
Posted By: Wjbender

Re: DLL is not loaded - 02/08/15 16:59

you can also recompile your dll ,but try to link different with

C++ Code Generation" >
"Runtime Library", choose
"Multithreaded (/MT)" as
opposed to "Mutithreaded
(Static)".

One of those options will link the extra libraries and stuff into you dll directly.

jb
Posted By: Ch40zzC0d3r

Re: DLL is not loaded - 02/08/15 17:21

Man just load it manually with LoadLibrary and get the exports with GetProcAddress.. who needs that auto-loading feature at all xD
Posted By: PadMalcom

Re: DLL is not loaded - 02/08/15 17:43

@Wjbender: Neither can I install old runtimes (Visual C++ Redistributables), since I have newer ones installed nor helps it to compile the DLL again with the current runtime.

@Ch40zzC0d3r: I'd like to know why the common way does not work but thanks for the hint laugh
Posted By: MasterQ32

Re: DLL is not loaded - 02/08/15 18:18

I don't think LoadLIbrary will work if the library has already loaded before.

Jonas, try http://www.dependencywalker.com/
It will resolve all dependencies for the DLL and you'll see the missing library if any
Posted By: Wjbender

Re: DLL is not loaded - 02/08/15 18:23

yeah I dont see how loadlibrary could achieve what the engine startup couldn't but hey I have seen weirder ..

this is pretty odd behaviour , the only thing I could think of was the standard libraries weren't staticly linked and therefore required the runtime libraries available for dynamic linking ..

the visual studio service packs includes runtimes
for crt mfc etc etc ,so if uts not in there then masterq32 is on to the answer for sure.

like to know what went wrong too if you solve it
Posted By: PadMalcom

Re: DLL is not loaded - 02/08/15 18:50

@MasterQ32: Nice tool, found the error using it laugh

I'm writing a Steam plugin and I forgot to add the steam_api.dll to the game folder. Now it works. Nevertheless, I have no idea why GS did not load the DLL. Maybe because all exported functions were unbound?
Posted By: Wjbender

Re: DLL is not loaded - 02/08/15 19:18

yeah missing dependency , great tool masterq32
Posted By: Ch40zzC0d3r

Re: DLL is not loaded - 02/08/15 19:57

Originally Posted By: PadMalcom
@MasterQ32: Nice tool, found the error using it laugh

I'm writing a Steam plugin and I forgot to add the steam_api.dll to the game folder. Now it works. Nevertheless, I have no idea why GS did not load the DLL. Maybe because all exported functions were unbound?


...
Try to load a DLL linked to another DLL via LoadLibrary as I told you and it will return NULL because not all functions could be resolved.
This could have been easy with LoadLib and GetLastError.
Posted By: MasterQ32

Re: DLL is not loaded - 02/08/15 20:12

@^:
Yes, but if there is not only one dependency but maybe 2 or 3 with only one missing function this will be pita. DependencyWalker is a nice and clear solution that only takes seconds to find out where the problem is
Posted By: Wjbender

Re: DLL is not loaded - 02/08/15 20:21

whoa masterq32 I just realised I used kartoffel's nick to refer to you in my previous reply , waaay sorry I fixed it lol
Posted By: Rackscha

Re: DLL is not loaded - 02/09/15 08:16

Originally Posted By: MasterQ32
I don't think LoadLIbrary will work if the library has already loaded before.


you can load a library as often as you want, you just need to unload it by the same amount of calls. It's reference counted.

If the dll was loaded before, LoadLibrary does not load anything, it just returns the already existing handle and increases ReferenceCounting by 1.

Same goes for FreeLibrary. It first Decrements the referencecount by 1, and if it reaches 0, it unloads the library. So if you "load" a library 3 times, you have to "Unload" it 3 times. Otherwhise it's keept until your process exits.
Posted By: Ch40zzC0d3r

Re: DLL is not loaded - 02/09/15 09:26

^this thanks wink
was actually too lazy to type that since its stated on msdn
Posted By: Wjbender

Re: DLL is not loaded - 02/09/15 10:01

^ & ^

you misunderstood the point , if the engine couldn't load the dll after gamestudio was freshly reinstalled (it used to be able to load it at startup) ,then loadlibrary would also not be able to load the library because obviously there's an issue with the library and not gamestudio , thats what we meant .
Posted By: MasterQ32

Re: DLL is not loaded - 02/09/15 16:27

@Rakscha: I know how LoadLibrary works, pretty good actually wink
The point is, what Wjbender said above.
Posted By: jcl

Re: DLL is not loaded - 02/10/15 10:32

The normal reason why Windows does not load a DLL is an unresolved dependency. Your DLL needs some other DLL that is not provided on your system. Maybe a certain DirectX version or something like that.

There is a free tool named "Dependency Walker" that you can use for fixing those problems.
Posted By: Rackscha

Re: DLL is not loaded - 02/10/15 12:30

Originally Posted By: MasterQ32
@Rakscha: I know how LoadLibrary works, pretty good actually wink
The point is, what Wjbender said above.

Then i mssunderstood you. Because, if a library loaded before LoadLibrary will work! but you stated the opposite^^
© 2024 lite-C Forums