C
caviar
Hi,
i'm having a problem with a native w32 dll. Everything is working fine
except for one parameter which is defined as:
--------------------------------------header file---
// short PASFIX PAF_GetRecord(short listndx, long recno,char *pafrec, short
pafreclen );
I'm having problems with the char *pafrec param, i translated (after
many/many/many) into this below, after trying several other usenet posting
suggesting stringbuilder, String etc.
-------------------------------------dllimport---------------------------
[DllImport("pafutw32.dll", CharSet = CharSet.Ansi, BestFitMapping= false,
ThrowOnUnmappableChar = true )]
unsafe public static extern short PAF_GetRecord(short listndx, short
recno, out string pafrec, ref short pafreclen );
----------
I get a Null value from this pafrec string, if i do a ref, it will be the
same value as i used there.
The working VB code is shown below, i'm not sure what this Dim . as string*
10000 is doing, i believe that would be the hint to get a DLLImport
declaration working.. But i for a starter do not know what *1000 is doing
there...
_Anyone knows what that line is supposed to do?_
_And, how can i pass that third parameter in there so i get a filled string
object back?_
TIA,
regards
Henk j M
------------------------------ vb code
Declare Function PAF_GetRecord Lib "pafutw32.dll" (ByVal lstndx As Integer,
ByVal recno As Long, ByVal rec As String, ByVal reclen As Integer) As
Integer
Dim rec As String * 10000
rec = ""
pafretc = PAF_GetRecordSize(lstndx, CInt(Text1.Text), recsize)
pafretc = PAF_GetRecord(lstndx, CInt(Text1.Text), rec, recsize)
----------------------PAF_GetRecordSize() --------from the manual
Function: PAF_GetRecordSize()
Syntax: short PAF_GetRecordSize(short listndx,long recno,
short *pafrecsizeptr);
Parameters: listndx is the internal reference to a hit list, obtained from
a call to PAF_SeekTerm() or PAF_CombineLists() or PAF_CombineAll().
recno is the record number within the list
(zero-origin)
pafrecsizeptr points to a short integer at which the length of the processed
Postcode record (including trailing null) will be placed
Returns: Zero if successful, see section 6 for other values
Description: Obtains the full length of the processed Postcode record with
relative record number recno in hit list listndx
Example:
Notes: The processed record is translated from the raw Postcode
record in internal storage. It is larger because all the 1-character data
item tags are expanded to 4 characters, and the 1-character data item
terminators become 2 characters.
See also: PAF_GetRawRecord(),PAF_GetRecord()
i'm having a problem with a native w32 dll. Everything is working fine
except for one parameter which is defined as:
--------------------------------------header file---
// short PASFIX PAF_GetRecord(short listndx, long recno,char *pafrec, short
pafreclen );
I'm having problems with the char *pafrec param, i translated (after
many/many/many) into this below, after trying several other usenet posting
suggesting stringbuilder, String etc.
-------------------------------------dllimport---------------------------
[DllImport("pafutw32.dll", CharSet = CharSet.Ansi, BestFitMapping= false,
ThrowOnUnmappableChar = true )]
unsafe public static extern short PAF_GetRecord(short listndx, short
recno, out string pafrec, ref short pafreclen );
----------
I get a Null value from this pafrec string, if i do a ref, it will be the
same value as i used there.
The working VB code is shown below, i'm not sure what this Dim . as string*
10000 is doing, i believe that would be the hint to get a DLLImport
declaration working.. But i for a starter do not know what *1000 is doing
there...
_Anyone knows what that line is supposed to do?_
_And, how can i pass that third parameter in there so i get a filled string
object back?_
TIA,
regards
Henk j M
------------------------------ vb code
Declare Function PAF_GetRecord Lib "pafutw32.dll" (ByVal lstndx As Integer,
ByVal recno As Long, ByVal rec As String, ByVal reclen As Integer) As
Integer
Dim rec As String * 10000
rec = ""
pafretc = PAF_GetRecordSize(lstndx, CInt(Text1.Text), recsize)
pafretc = PAF_GetRecord(lstndx, CInt(Text1.Text), rec, recsize)
----------------------PAF_GetRecordSize() --------from the manual
Function: PAF_GetRecordSize()
Syntax: short PAF_GetRecordSize(short listndx,long recno,
short *pafrecsizeptr);
Parameters: listndx is the internal reference to a hit list, obtained from
a call to PAF_SeekTerm() or PAF_CombineLists() or PAF_CombineAll().
recno is the record number within the list
(zero-origin)
pafrecsizeptr points to a short integer at which the length of the processed
Postcode record (including trailing null) will be placed
Returns: Zero if successful, see section 6 for other values
Description: Obtains the full length of the processed Postcode record with
relative record number recno in hit list listndx
Example:
Notes: The processed record is translated from the raw Postcode
record in internal storage. It is larger because all the 1-character data
item tags are expanded to 4 characters, and the 1-character data item
terminators become 2 characters.
See also: PAF_GetRawRecord(),PAF_GetRecord()