Subject | Re: Delphi UDF with PChar |
---|---|
Author | yaedos2000 |
Post date | 2006-02-16T15:50Z |
The cdecl directive has sorted it out, thanks for your help!!
> T> Length(InputString), I think, will always return "4" -> that isthe
> MT> length of the pointer.Try StrLen instead.IT???
>
> And don't forget about cdecl for the function.
>
> >> > > I'm having trouble writing a UDF in Delphi that returns a
> >> > > PChar. This is a simple example of what I'm trying to do:
> >> > >
> >> > > function test(InputString: PChar): PChar; begin
> >> > > result := StrAlloc(Length(InputString));
> >> > > StrCopy(result, InputString);
> >> > > // Presumably the StrAlloc will be freed by the UDF's FREE
> >> > > end;allocate
> >> >
> >> > Shouldn't you use IBMalloc (or similar name) function to
> >> memory
> >> > instead of StrAlloc?
>
>
>
> --
> Best regards,
> Pavel Menshchikov
> http://www.ls-software.com
>