PDA

View Full Version : Call DLL may require Load DLL



NewsArchive
02-21-2005, 05:38 AM
[Tuesday, February 15, 2005 8:10 PM]

I thought I'd mention this in case it can save someone else a couple of hours
of frustration. The short version of this is if you're calling into a DLL
that itself makes other external DLL calls, Load DLL may be required for
those externals.

In testing a Clarion DLL for use in SB5 I found a called function was failing
silently. As best as I could tell it wasn't actually being called at all.
This DLL has dependencies in two other C++ DLLs. After a couple of hours of
fooling with this it dawned on me that those C++ DLLs were apparently not
being loaded. Two Load DLL calls in the SB5 script was all that was needed.

--
Best regards,

Mark

NewsArchive
02-21-2005, 05:38 AM
[Tuesday, February 15, 2005 8:38 PM]

Good tip, Mark. Can you give us an example snippet? I think SB's scripting
language may need a few examples to get folks off and running. ;-)

--
Russ Eggen
www.radfusion.com

NewsArchive
02-21-2005, 05:39 AM
[Tuesday, February 15, 2005 9:20 PM]

>Good tip, Mark. Can you give us an example snippet? I think SB's scripting
>language may need a few examples to get folks off and running. ;-)

Russ,

Actually, Friedrich already has. :} His "Call Dll Demo 2.sb5" illustrates
using Load DLL and using its handle in a Call DLL. That's really all that's
needed for Load DLL.

In my case, there are two differences from his example. I needed the Load DLL
calls as my Clarion DLL isn't doing that itself. Friedrich's example uses the
module handle in the function call. I didn't need that. So my Call DLL is
just a normal function call into the Clarion DLL.

What I wish I could document for others is the "why" of all this, or more
precisely, the specific conditions under which it is required. My guess is
that in a freestanding program the CW RTL would handle the loading of all the
required DLLs, and that bit is missing this utility DLL I have.

--
Best regards,

Mark