| View previous topic :: View next topic |
| Author |
Message |
Tommy Admin Team
Joined: 16 Nov 2002 Posts: 746 Location: The Netherlands
|
Posted: Tue Jul 01, 2003 3:41 am Post subject: VDS 5 extension exceptions |
|
|
If any exception occurs in an extension DLL, VDS is supposed to return error 27:
Untrapped error in an external command or function.
VDS 5 doesn't return error 27 in such cases, unlike older VDS versions. Instead it
will return an error based on the extension's maxPar value, increased by 1.
The following slightly modified version of the DLL in extdoc10.zip clearly illustrates
the problem:
http://www.vdsworld.com/files/vds5extbug.zip
The only line that is added in it, is this one:
raise EConvertError.Create('Error 27 should be returned now, but instead maxPar + 1 is returned.'); |
|
| Back to top |
|
 |
jules Professional Member


Joined: 14 Sep 2001 Posts: 1043 Location: Cumbria, UK
|
Posted: Tue Jul 01, 2003 8:33 am Post subject: |
|
|
Thanks for posting this example, Tommy. I have tested it, and reported to Commercial Research what I think the problem is.
Incidentally, I was wrong when I stated in an earlier post that the maxpar value is no longer needed. It is. It is only the bufsize value that is ignored. _________________ The Tech Pro
www.tech-pro.net |
|
| Back to top |
|
 |
marty Professional Member


Joined: 10 May 2001 Posts: 789
|
Posted: Tue Jul 01, 2003 11:45 am Post subject: |
|
|
I would like to personnaly thank Tommy for his research on this problem. Hope this will help resolve the VDS 5 problems that has been encountered with lots of extensions.
Hope Commercial Research will resolve this problem soon.  |
|
| Back to top |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Tue Jul 01, 2003 12:27 pm Post subject: |
|
|
Yes Tommy, thank you for finding what the exact problem is.  _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
Hortalonus Valued Contributor


Joined: 15 Mar 2002 Posts: 344 Location: Western USA
|
Posted: Tue Jul 01, 2003 3:23 pm Post subject: |
|
|
Tommy rocks!  _________________ "ah, come take my hand... we're ridin' out tonight to face the promised land"
Get a free iPod mp3 player... |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Wed Jul 02, 2003 1:24 pm Post subject: |
|
|
| jules wrote: | Thanks for posting this example, Tommy. I have tested it, and reported to Commercial Research what I think the problem is.
Incidentally, I was wrong when I stated in an earlier post that the maxpar value is no longer needed. It is. It is only the bufsize value that is ignored. |
Hi All,
I don't know if Delphi has limitations when it comes to the length of character arrays but most C/C++ compilers for Win32 do have a limitation to the number of characters that can be in a character or byte array and that is 4096. All DLL developers should consult their documentation to see what the limits are. I just wanted to throw in my 2cents. _________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
Alex Newbie
Joined: 29 Jan 2004 Posts: 2 Location: Germany
|
Posted: Thu Jan 29, 2004 8:02 am Post subject: |
|
|
| jules wrote: |
Incidentally, I was wrong when I stated in an earlier post that the maxpar value is no longer needed. It is. It is only the bufsize value that is ignored. |
I'am using my own external dll and up to now I have used the bufsize Parameter. But if this is ignored, how do I know the size of the buffer I get from VDS.
As an example:
If I set maxpar to 20 and I call a funktion with only one Parameter are there 19 empty strings in the buffer, so I just have to receive all 20 Parameters with getNextParm without needing to know the buffsize?
javascript:emoticon(' ') Every help is welcome! |
|
| Back to top |
|
 |
jules Professional Member


Joined: 14 Sep 2001 Posts: 1043 Location: Cumbria, UK
|
Posted: Thu Jan 29, 2004 9:21 am Post subject: |
|
|
Maxpar is only used by VDS so it can pad out every string passed to an extension with extra empty strings in order that an error does not occur when the params/arguments are read. In fact, maxpar is a global value for VDS so all extensions will receive strings padded to the largest value of maxpar specified by any of the extensions that have been loaded. (It just means the addition of extra null bytes on the end of the string.) The reason is to avoid the access violation that would occur if the extension called NextParam more times than the number of values that were actually supplied by the calling script.
Bufsize was required by earlier versions of VDS which reserved a block of memory to receive the string passed from the return value of a function back to VDS. VDS 5 has been improved so that you can pass any length of string or PChar it is reasonable to return as the return value of a function, therefore it is not necessary to specify a maximum size. _________________ The Tech Pro
www.tech-pro.net |
|
| Back to top |
|
 |
Alex Newbie
Joined: 29 Jan 2004 Posts: 2 Location: Germany
|
Posted: Thu Jan 29, 2004 9:28 am Post subject: |
|
|
Many thanks for that very quick and great answer. Now I'm sure, that I use the parameterbuffer in the right way. |
|
| Back to top |
|
 |
|