PDA

View Full Version : Calling procedures in a support file DLL



NewsArchive
01-26-2016, 11:51 AM
I'm getting a crash when I call a particular function in my C6.3
support DLL more than once.

This one has a Clarion window and accept loop.

If I call that function, it works fine the first time. All I'm doing
is opening the window and cancelling out via an std:close button

Then, if I call it or any other functions (including that one) in the
DLL, it will crash.

I tried explicitly closing the window after the accept loop, and that
didn't help.

Nothing after the CODE section of that procedure executes before the
crash.

Does SB fully release a DLL after it's called?

I am wondering if I should be getting a module handle and re-using it.


Jeff Slarve
www.jssoftware.com
Twitter free since Jan 11, 2016
I'll search help files & Google for you.

Grammar troll's, are the worse.

NewsArchive
01-26-2016, 11:52 AM
Also, there is no info on the crash. Just get "xxx.exe stopped
working"

In the meantime, I'll just force an exit of the setup after calling
that procedure<g>

Jeff Slarve
www.jssoftware.com
Twitter free since Jan 11, 2016
I'll search help files & Google for you.

Grammar troll's, are the worse.

NewsArchive
01-27-2016, 02:21 AM
Hi Jeff,

> Nothing after the CODE section of that procedure executes before the
> crash.

I have a dll that is called twice in my Utilities install. So far so
good. It's a hand coded C6 dll, but it does not have any windows.

Best regards,

--
Arnor Baldvinsson
Icetips Alta LLC

NewsArchive
01-27-2016, 02:21 AM
Hi Arnor -

Thanks. Me too. I'm definitely not new to calling procedures in
support dlls from SB, but this one has me befuddled.

Jeff Slarve
www.jssoftware.com
Twitter free since Jan 11, 2016
I'll search help files & Google for you.

Grammar troll's, are the worse.

NewsArchive
01-27-2016, 02:22 AM
Jeff,

> Thanks. Me too. I'm definitely not new to calling procedures in
> support dlls from SB, but this one has me befuddled.

Try Load DLL, Call DLL Function and then Unload DLL.

--
Lee White

RPM Report Viewer.: http://www.cwaddons.com/products/rpm/
RPM Review........: http://www.clarionmag.com/cmag/v11/v11n06rpm.html
Report Faxing.....: http://www.cwaddons.com/products/afe/
---Enroll Today---: http://CWaddons.com

Creative Reporting: http://www.CreativeReporting.com

Product Release & Update Notices
http://twitter.com/DeveloperPLUS

Windows 8 brings us "The Oval, Bumper Car, Roller Coaster of Wait!"
And, now, Windows 10 brings us "The Inch Worm, Bumper Car of Wait!"

NewsArchive
01-27-2016, 02:23 AM
Hi Jeff,

> Thanks. Me too. I'm definitely not new to calling procedures in
> support dlls from SB, but this one has me befuddled.


FWIW, I'm using this as the prototypes:

IT_SearchAndReplace(*CString pFind, *CString pReplaceWith, *CSTRING
pFilename),LONG,PASCAL,Name('IT_SEARCHANDREPLACE')
IT_FixRunDLL(*CSTRING pFilename),LONG,PASCAL,Name('IT_FIXRUNDLL')

and the exp has:

NAME IT_SBDLL GUI
EXPORTS
IT_SEARCHANDREPLACE @1
IT_FIXRUNDLL @2

And I just discovered that IT_SearchAndReplace DOES have a window that
is opened & closed. And there are two calls to it. I'm using the "Call
DLL function" and I'm not unloading the dll.

Best regards,

--
Arnor Baldvinsson
Icetips Alta LLC

NewsArchive
01-27-2016, 02:36 AM
Hi Jeff,

I have attached a simple .DLL source code and .SBP to reproduce this at will
with a single DLL call <g>.

1. Compile "SBDLL.PRJ" with Clarion 6 (generates "sbdll.dll").

2. Compile "Call Dll.sbp" with SetupBuilder (version does not matter)

3. Run "Call Dll.exe"

No GPF.

Okay, now change a single line in the .CLW (see attached screenshot)

Comment-IN the following line:

! ?OkButton{PROP:Tip} = 'test' ! causes a GPF

Recompile the DLL, recompile the SetupBuilder executable, and run "Call
Dll.exe"

At the end, you'll get a wonderful GPF <g>.

Friedrich

NewsArchive
01-28-2016, 02:02 AM
Thanks Friedrich. I wish that was it.

There are no run-time window property changes.

This procedure always runs successfully the first time. Then kaput if
I call it again or any other procedure in that (or even a different)
dll.

After commenting out a call that came before this one, the attached
screenshot is now what's happening on the 2nd call. This way it does
not crash the Setupbuilder.exe, but my DLL doesn't work.

Since I had all of those Clarion DLLs included in my support files
before, I thought it might be getting confused over which C60runx to
use. So I killed all of those files from my support files (because
this Setupbuilder exe is always run where my app is anyway).

It didn't help with the version 0.0000.0 thing.

I will leave it be for a while, and just exit the install after that
procedure is called. :-\

Thanks again

Jeff Slarve
www.jssoftware.com
Twitter free since Jan 11, 2016
I'll search help files & Google for you.

Grammar troll's, are the worse.

NewsArchive
01-28-2016, 02:03 AM
I sent some stuff to your email, Friedrich.

Thanks.

Jeff Slarve
www.jssoftware.com
Twitter free since Jan 11, 2016
I'll search help files & Google for you.

Grammar troll's, are the worse.

NewsArchive
01-28-2016, 02:03 AM
Hi Jeff,

> Thanks Friedrich. I wish that was it.
>
> There are no run-time window property changes.

Yes, I just wanted to point out that this has absolutely nothing to do with
the calling EXE application <g>. The EXE just calls the DLL and waits for
its return. The DLL causes a stack corruption and this brings the system
down. If you call the DLL from, say, a Visual Studio C++ app then the same
will happen.

Friedrich