Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[Dialog] Scripting - Calling external DLL causes Could Not Call Proc

560 views
Skip to first unread message

Jeff

unread,
Jun 5, 2004, 1:27:23 AM6/5/04
to
I'm writing a script that calls a custom DLL. I've been able to declare
the methods in the DLL and make calls to those methods in the DLL. The DLL
executes fine, however, when the method in the DLL is finished and returns
back to Dialog, I get the error message: Error running script "test": Could
not call proc

I've removed everything from the DLL method and just have it return. I've
also placed message pop ups in the script right after the call to the DLL
method to see if it continues on, but it does not. It appears to execute
the DLL methods fine, but upon return something occurs and it shuts down
the script.

Anyone run into this problem?

Thanks,
Jeff

Message has been deleted

Jeff

unread,
Jun 5, 2004, 2:11:29 PM6/5/04
to
On Sat, 5 Jun 2004 11:07:10 +0200, Alain GUERIN wrote:

> Path: sn-us!sn-xit-05!sn-xit-08!supernews.com!newsfeed.online.be!193.109.243.20.MISMATCH!newsfeed.stueberl.de!proxad.net!feeder2-1.proxad.net!news6-e.free.fr!not-for-mail
> From: Alain GUERIN <courr...@alain-guerin.com>
> Subject: Re: [Dialog] Scripting - Calling external DLL causes Could Not Call Proc
> Newsgroups: news.software.readers
> User-Agent: 40tude_Dialog/2.0.11.1 (8a435ff6.331.356)
> MIME-Version: 1.0
> Content-Type: text/plain; charset="us-ascii"
> Content-Transfer-Encoding: 7bit
> Reply-To: new...@alain-guerin.com
> Organization: NA
> References: <hlofdrweet5e$.12pmj6hf...@40tude.net>
> Date: Sat, 5 Jun 2004 11:07:10 +0200
> Message-ID: <6d71vxvej5nu$.d...@alain-guerin.com>
> Archive: no
> X-Face: '*&f@caq/y%f)QY'BcSO`EQH}'>nCphQ%q>YfG1"zCmQAa]-,^B1-<u0)r)}QS_wzU)5`a` %|NRB0OU/Q><ozTuEx.M+[fx'?9U\Ojwtt>FBPmKGeE=.(/%Gv4+w/T9UqY}e]~jQzpXe&"V84G%al +i$O,EHjhE.c[7qzp+C4VL<
> Mail-Copies-To: never
> X-No-Archive: yes
> Lines: 25
> NNTP-Posting-Date: 05 Jun 2004 11:07:18 MEST
> NNTP-Posting-Host: 81.57.20.30
> X-Trace: 1086426438 news6-e.free.fr 12755 81.57.20.30:3611
> X-Complaints-To: ab...@proxad.net
> Xref: sn-us news.software.readers:173620
>
> Hello,

> Did you declare your external function with the proper call ? (external
> 'Messa...@user32.dll stdcall';) for a standard call, etc.

It does have something to do with the declaration or how the DLL is
compiled. After some more testing, i've found that it has something to do
with the parameters. Here's my original declares in the script:
FUNCTION ProcessFile(sSubject: pchar):boolean; external
'Proce...@padll.dll stdcall';
FUNCTION PA(a:INTEGER):boolean; external 'P...@padll.dll stdcall';
And in the C++ DLL:
extern "C" __declspec(dllexport) bool ProcessFile(char *sSubject)
extern "C" __declspec(dllexport) bool PA(int a)

I've tried several variations of types in the Script/C++ to see if it had
any effect, but I still get the same problem. I've also tried forcing the
__stdcall calling convention in the DLL (no effect). I have determined
though, that if I make the method have no parameters, I don't get the could
not call proc error.

Utimately, I want to pass 1 string parameter to the DLL. The current
ProcessFile with a string parameter does get the correct data from the
script. Its just that the script gets that error upon returning back.

I'm going to keep playing with the parameter types and DLL options, but i'd
appreciate any other ideas as well.

Thanks,
Jeff

Jernej Simončič

unread,
Jun 6, 2004, 8:03:55 AM6/6/04
to
on Sat, 5 Jun 2004 13:11:29 -0500, Jeff wrote:

> I'm going to keep playing with the parameter types and DLL options, but i'd
> appreciate any other ideas as well.

This example comes with Inno Setup (which uses the same script engine as
Dialog), maybe you'll be able to help yourself with this:

MyDLL.c:

#include <windows.h>
void __stdcall MyDllFunc(HWND hWnd, char *lpText, char *lpCaption, UINT
uType)
{
MessageBox(hWnd, lpText, lpCaption, uType);
}


Declaration in script:

procedure MyDllFunc(hWnd: Integer; lpText, lpCaption: String; uType: Cardinal);
external 'MyDl...@MyDll.dll stdcall';

--
begin .sig
< Jernej Simončič ><◊>< http://www2.arnes.si/~sopjsimo/ >
< jernej simoncic at isg si ><http://deepthought.ena.si/>
end

Jeff

unread,
Jun 8, 2004, 8:39:33 PM6/8/04
to
> This example comes with Inno Setup (which uses the same script engine as
> Dialog), maybe you'll be able to help yourself with this:
>
> MyDLL.c:
>
> #include <windows.h>
> void __stdcall MyDllFunc(HWND hWnd, char *lpText, char *lpCaption, UINT
> uType)
> {
> MessageBox(hWnd, lpText, lpCaption, uType);
> }
>
>
> Declaration in script:
>
> procedure MyDllFunc(hWnd: Integer; lpText, lpCaption: String; uType: Cardinal);
> external 'MyDl...@MyDll.dll stdcall';

Thanks for the reply. I tried several more configurations, including using
the above example. I believe it has to do with the way the DLL is being
compilied.

Instead of continuing down this path, I converted the DLL to Delphi. The
Delphi version of the DLL does not have the same problem.

Thanks for all the suggestions.

Jeff

0 new messages