Environment:
Win XPx64
VS.Net 2005
I am forcing the compile as a 32bit only application.
I have been trying to pass a string to a C DLL. Basically the string is a file path sch as "D:\Arc2Cad\Test\MyFile.shp"
The DLL returns an error message saying the path "D" has an improper file extension.
I could send the string "ABCDEFG" and get the same error saying "A" has an improper file extension.
Obviosly the DLL is reading only the first character of the string.
I've used several forms of declare such as :
Private Declare Auto Function exec_arcv2cad Lib "D:\Arc2Cad\a2c32.dll" _
(
ByVal lpCmdLine As String, ByVal Flags As Int32) As Int32
Private
Declare Auto Function exec_arcv2cad Lib "D:\Arc2Cad\a2c32.dll" _(
ByVal lpCmdLine As System.Text.StringBuilder, ByVal Flags As Int32) As Int32
<DllImport(
"D:\Arc2Cad\a2c32.dll", BestFitMapping:=True, _CallingConvention:=CallingConvention.Cdecl, _
SetLastError:=
True, CharSet:=CharSet.Ansi)> Function init_arcv2cad _(
ByVal lpValue As String, ByVal Flags As Int32) As Long End Function
<DllImport(
"D:\Arc2Cad\a2c32.dll", BestFitMapping:=True, _CallingConvention:=CallingConvention.Cdecl, _
SetLastError:=
True, CharSet:=CharSet.Ansi)> Function init_arcv2cad _(
ByVal lpValue As System.Text.StringBuilder, ByVal Flags As Int32) As Long End Function
I've passed strings, StringBuilders, Byte arrays with a null as the last byte, etc.
No Joy
But this same dll works in VBA quite nicely with this declare:
Private Declare Function exec_arcv2cad Lib "a2c32.dll" _
(ByVal lpCmdLine As String, ByVal Flags As Long) As Long
C Prototype:
typedef int(Callback* LPFN_EXEC_ARC@CAD) (
char *lpcmdline,
int Flags);
LPFN_EXEC_ARC2CAD exec_arcv2cad;
Could sure use some help here....
Thanks in advance.