Re: calling C/C++ DLL that takes a pointer to LPTSTR
- From: "Nicholas Paldino [.NET/C# MVP]" <mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 15 Jun 2005 11:26:26 -0400
Sam,
Is lpFileNames written to? If not, then just pass it as an array. I
assume you would have to pass a null string at the end of the array, but
that should translate just fine.
Also, make sure you do not use long in C# when defining this function.
Use int (LONGs in C/C++ are 32 bit integers).
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx
"Sam Carleton" <scarleton-nospam@xxxxxxxxxxxxxxxx> wrote in message
news:4HXre.42390$XA6.31136@xxxxxxxxxxxxxxxxxxxxxxxxx
> The C definition is along the lines of:
>
> LONG SetFilenames( LONG nFiles, LPCSTR* lpFileNames);
>
> Where the lpFileNames is an array of LPCSTR's.
>
> The ultimate DLL that needs to be called is a 3rd party's module,
> but there is a C/C++ DLL which is a wrapper for the 3rd party
> module, this wrapper is called directly by C#. There does not
> appear that such a method signature can be called direct from C#.
> What tactic should be used to get a collection of strings from C#
> to the wrapper class? A fellow developer suggested that I define
> a struct in C# that simply contains a string. I know that it
> would work, but it is messy and I am looking for a more straight
> forward, cleaner approach. Any ideas?
>
> Sam
.
- Follow-Ups:
- Re: calling C/C++ DLL that takes a pointer to LPTSTR
- From: Sam Carleton
- Re: calling C/C++ DLL that takes a pointer to LPTSTR
- References:
- calling C/C++ DLL that takes a pointer to LPTSTR
- From: Sam Carleton
- calling C/C++ DLL that takes a pointer to LPTSTR
- Prev by Date: Re: FTP in ASP.NET C#
- Next by Date: Passing a null value to a DateTime property
- Previous by thread: calling C/C++ DLL that takes a pointer to LPTSTR
- Next by thread: Re: calling C/C++ DLL that takes a pointer to LPTSTR
- Index(es):
Relevant Pages
|