c# - Using DLLImport with an output char[] containing null characters -
I am writing a C # app using .NET 2.0. I need to use an old library for proprietary compression. I do not have the source code for the library, and the developer has gone a long way behind it.
My problem is that the result is null in four [], and this is declining for the function being reduced:
[DLLImport ("foo .dll ")] Public static buntal compresses (four [] inputwalls, out four [] outputwalls, input input length, out UIT outputLength);
How can I declare that the output should be handled as four by [] byte, and the tap should not be finished?
More information:
I have a header file. Here is the declaration:
BOOL compressress (four * decampfuff, four ** retbuff, unsigned long DecompLen, unsigned long * RetCompLen);
Look for an ARA to pass in P / Invasion. I think you want to use the SizeParamIndex
, which tells the Marshaller, which keeps the log of the log passed arrays.
Edit: SizeParamIndex
is unfortunately not allowed on outside
and riff
parameters, however, can manually copy it [DLLImport ("foo.dll")] Public Static Extensions Bull Compressed ([Marshall AS (Unmanaged Type. LPRRA, Size Param Index = 2)] Four [] Input Value, Out Output IntPtr Output, UIIT Input Lang, Out UIT Output Lamp); Public Static Child Compacting Invoc (four [] InputWalls, Out-Four [] Output Value, UIIT Input Lang) {Intitrout Output PTR; UIT OutputLen; If (compressed string (input voltage, output PTR, input length, out output)) {outputValue = new four [outputLen]; Marshall.Copy (Output PTR, Output Value, 0, (Int) Output LAN); Back true; } OutputValue = New four [0]; return false; }
Comments
Post a Comment