Hello,
I have a VB6.0 application which calls a PASCAL DLL (it is actually a
Clarion DLL compiled as ,PASCAL). This DLL returns the memory address of a
large string. How do I then access that?
ie:
MemoryAddress = PascalFunction(in1,in2)
Can this be done?
The DLL does this:
glo:returnData = '2mb string'
return(ADDRESS(glo:returnData))
OR?
How can I pass large strings (2MB and 4MB max) from the DLL back to the
VB6.0 application. I don't believe I can return it this way:
returnString = PascalFunctio(in1,in2)
because I believe the maximum allowed is 64K string size?
Essentially, I need to be able to handle take a large string in the PASCALL
DLL, pass it to the VB6.0 EXE and then pass it further up the chain to a
VBScript/ASP page.
Any suggestions?
Thank you.
Jim Mack - 09 Apr 2008 05:05 GMT
> Hello,
>
> I have a VB6.0 application which calls a PASCAL DLL (it is actually
> a Clarion DLL compiled as ,PASCAL). This DLL returns the memory
> address of a large string. How do I then access that?
A lot depends on what sort of string is being created. If it's an OLE
BSTR, which is what VB uses internally, then you can just return it as
the function result, after accounting for Ansi/Unicode conversion
issues (details once you tell us more). There is no effective limit
(OK, 2GB) on the size of a VB string.
Describe the exact format of the string being returned and we can help
more.
--
Jim Mack
MicroDexterity Inc
www.microdexterity.com
> MemoryAddress = PascalFunction(in1,in2)
>
[quoted text clipped - 21 lines]
>
> Thank you.
Karl E. Peterson - 09 Apr 2008 17:40 GMT
> I have a VB6.0 application which calls a PASCAL DLL (it is actually a
> Clarion DLL compiled as ,PASCAL). This DLL returns the memory address of a
> large string. How do I then access that?
You can dereference an ANSI string pointer like this:
Public Function PointerToStringA(ByVal lpStringA As Long) As String
Dim Buffer() As Byte
Dim nLen As Long
If lpStringA Then
nLen = lstrlenA(ByVal lpStringA)
If nLen Then
ReDim Buffer(0 To (nLen - 1)) As Byte
CopyMemory Buffer(0), ByVal lpStringA, nLen
PointerToStringA = StrConv(Buffer, vbUnicode)
End If
End If
End Function
Unicode is very similar. Complete code/declarations at
http://vb.mvps.org/samples/HexDump

Signature
.NET: It's About Trust!
http://vfred.mvps.org