Sfoglia il codice sorgente

HPCC-9482 Fix code for calls to external c++ functions returning rows.

A regression from the time when we switched to linkcounted rows everywhere.

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Gavin Halliday 12 anni fa
parent
commit
85cd29faaa
2 ha cambiato i file con 15 aggiunte e 1 eliminazioni
  1. 1 1
      ecl/hqlcpp/hqlcpp.cpp
  2. 14 0
      ecl/regress/issue9482.ecl

+ 1 - 1
ecl/hqlcpp/hqlcpp.cpp

@@ -5776,7 +5776,7 @@ void HqlCppTranslator::doBuildCall(BuildCtx & ctx, const CHqlBoundTarget * tgt,
                     resultRowBuilder.setown(createRowBuilder(ctx, resultRow));
                     IHqlExpression * bound = resultRowBuilder->queryBound();
                     args.append(*getPointer(bound));
-                    localBound.expr.set(bound);
+                    localBound.expr.setown(getPointer(resultRow->queryBound()));
                 }
                 returnByReference = true;
             }

+ 14 - 0
ecl/regress/issue9482.ecl

@@ -0,0 +1,14 @@
+FO := SERVICE
+  {varstring512 mya, varstring512 myb} GetInfo(const varstring in_a, const varstring in_b):c,pure,entrypoint='GetInfo';
+END;
+
+{varstring512 mya, varstring512 myb} FOO(const varstring in_a, const varstring in_b):= BEGINC++
+    struct FO_ { char mya[513]; char myb[513]; };
+    FO_ * FOO = (FO_*)__result;
+    strncpy(FOO->mya, in_a, 512);
+    FOO->mya[512] = 0;
+    strncpy(FOO->myb, in_b, 512);
+    FOO->myb[512] = 0;
+ENDC++;
+
+FOO('a','b');