title: Delphi Firebird UDF return only one char
body: <p>I'm using Firebird 2.5.</p>
  
  <p>I'm trying to write a Delphi XE2 UDF to return some string from some input params.</p>
  
  <p>Here is the function in Delphi:</p>
  
  <pre><code>function  FormatRasaSingle(var formatRasa : PChar; var aDenumire : PChar; var aCod : PChar; var aSimbol : PChar; var aTulpina : PChar) : PChar;
  var tmpString  : String;
      tmpInteger : Integer;
  begin
    tmpString := formatRasa;
    tmpString := StringReplace(tmpString, '#DENUMIRE', aDenumire, [rfReplaceAll, rfIgnoreCase]);
    tmpString := StringReplace(tmpString, '#COD', aCod, [rfReplaceAll, rfIgnoreCase]);
    tmpString := StringReplace(tmpString, '#SIMBOL', aSimbol, [rfReplaceAll, rfIgnoreCase]);
    tmpString := StringReplace(tmpString, '#TULPINA', aTulpina, [rfReplaceAll, rfIgnoreCase]);
    tmpString := 'MAMA';
    tmpInteger := Length(tmpString) + 1;
    Result     := ib_util_malloc(tmpInteger);
    StrPCopy(Result, tmpString);
  end;
  </code></pre>
  
  <p>the udf declaration is:</p>
  
  <pre><code>DECLARE EXTERNAL FUNCTION FORMATRASASINGLE
      CSTRING(255),
      CSTRING(255),
      CSTRING(255),
      CSTRING(255),
      CSTRING(255)
  RETURNS CSTRING(255) FREE_IT
  ENTRY_POINT 'FormatRasaSingle' MODULE_NAME 'eliteSoftFirebird';
  </code></pre>
  
  <p>when i'm trying to test the function result only the first letter "M".</p>
  
  <p>the lines</p>
  
  <pre><code>   tmpString := 'MAMA';
  </code></pre>
  
  <p>is for test only. The real code is before this line.</p>
  
  <p>but is not working.</p>
  
  <p>can someone advice me?</p>
  
  <p>where is the mistake?</p>
  
  <p>Also when I try to input one parameter I get a big error like "error reading data from the connection".</p>
  
  <p>Tks </p>
  
  <p>Razvan</p>
  
  <hr>
  
  <p>how this function must be assuming the double parameters is Numeric (5, 2)? </p>
  
  <pre><code>function  FormatRasaMultiple(const formatRasa, aDenumire, aCod, aSimbol, aTulpina : PAnsiChar; aProcent : Double) : PAnsiChar; cdecl; export;
  </code></pre>
  
  <p>the function is exactly the same as previos one BUT have one more numeric parameter.</p>
  
  <p>so far (my old UDF Firebird 1.5) I was using the declaration as "var aProcent : Double" but when I return it has no value.</p>
  
  <p>the UDF is declared like this:</p>
  
  <pre><code>DECLARE EXTERNAL FUNCTION FORMATRASAMULTIPLE
      CSTRING(255),
      CSTRING(255),
      CSTRING(255),
      CSTRING(255),
      CSTRING(255),
      NUMERIC(5, 2)
  RETURNS CSTRING(255) FREE_IT
  ENTRY_POINT 'FormatRasaMultiple' MODULE_NAME 'eliteSoftFirebird';
  </code></pre>