<p>Given the following Delphil DLL declaration</p>

<pre><code>function csd_HandleData(aBuf: PChar; aLen: integer): integer; stdcall;
</code></pre>

<p>what would be the VB6 declaration to use it?</p>

<p>I've tried a variety of declarations, e.g.</p>

<pre><code>Declare Function csd_HandleData Lib "chsdet.dll" (ByVal aBuf As String, ByVal aLen As Integer)
Declare Function csd_HandleData Lib "chsdet.dll" (aBuf As Long, ByVal aLen As Integer)
Declare Function csd_HandleData Lib "chsdet.dll" (aBuf As Byte, ByVal aLen As Integer)
</code></pre>

<p>with the relevant code to suit the parameters, but nothing seems to work, i.e. the Delphi debugger says I have a too-largish value in aLen and a null string in aBuf.</p>

<p>I am working toward using a TypeLib to drive the connection, but was prototyping with Declares.</p>

try
```
```
Declare Function csd_HandleData Lib "chsdet.dll" (ByVal aBuf As String, 
ByVal aLen As Integer) As Integer
```
```
Seems you forgot the return value.