user
This task has been clarified. Its programming examples are in need of review to ensure that they still fit the requirements of the task.

This task is inverse to the task Call foreign language function. Consider the following C program:

```
#include <stdio.h>

extern int Query (char * Data, size_t * Length);

int main (int argc, char * argv [])
{
   char     Buffer [1024];
   size_t   Size = sizeof (Buffer);
   
   if (0 == Query (Buffer, &Size))
   {
      printf ("failed to call Query\n");
   }
   else
   {
      char * Ptr = Buffer;
      while (Size-- > 0) putchar (*Ptr++);
      putchar ('\n');
   }
}

```

Implement the missing `Query` function in your language, and let this C program call it. The function should place the string *Here am I* into the buffer which is passed to it as the parameter `Data`. The buffer size in bytes is passed as the parameter `Length`. When there is no room in the buffer, `Query` shall return 0. Otherwise it overwrites the beginning of `Buffer`, sets the number of overwritten bytes into `Length` and returns 1.
assistant
(formerly Perl 6)
This SO answer, by JJ Merelo, explained the difficulty on providing a simple solution.  So this attempt takes the same approach as PicoLisp by summoning the interpreter at run time.

**Translation of**: PicoLisp

query.raku

```
#!/usr/bin/env raku

sub MAIN (Int :l(:len(:$length))) {
   my Str $String = "Here am I";
   $*OUT.print: $String if $String.codes ≤ $length
}

```

query.c

```
#include<stdio.h>
#include<stddef.h>
#include<string.h>

int Query(char *Data, size_t *Length) {
   FILE *fp;
   char buf[64];

   sprintf(buf, "/home/user/query.raku --len=%zu", *Length);
   if (!(fp = popen(buf, "r")))
      return 0;
   fgets(Data, *Length, fp);
   *Length = strlen(Data);
   return pclose(fp) >= 0 && *Length != 0;
}

```

Output:

```
gcc -Wall -o main main.c query.c
./main
Here am I

```