When I tested it: the insert somehow did not happen. Could you tell me what I missed? Do I have to pass X in as a parameter? Or I cannot allocate x using knk inside the function?
To run the test:
1. compile the code as DLL 2. create table as: all_dt:(seq:int$();cchar:char$();cshort:short$();cint:int$ ();cfloat:float$();csym:symbol$();time:`time$()) 3. load the dll and run the test 4. show all_dt in q console.
I altered the code slightly to make it work, the basic problem wasthat the time column had been left out on the C side (the call to knkand - obviously - in the for loop):#include <stdio.h>#include "k.h"K startAud(K y){ int bulkSize=3; int i; K err = NULL; K x=knk(7, // Set to 7 as we are adding time ktn(KI, bulkSize), ktn(KC, bulkSize), ktn(KH, bulkSize), ktn(KI, bulkSize), ktn(KF, bulkSize), ktn(KS, bulkSize), ktn(KT, bulkSize)); // Add time for(i=0; ii; // Time is simple scalar } err = k(0, “insert”, ks((S)“all_dt”), x, (K)0); if (err->t == -128) O(“err = %s \n”, err->s); return ki(y->i);}Creating a nice small test script:cat > t.qall_dt:( seq:int$(); cchar:char$(); cshort:short$(); cint:int$(); cfloat:float$(); csym:symbol$(); time:time$())startAud:t 2:(`startAud; 1)startAudshow all_dt^DLoading the script for a go with the code:q) \l t.q0seq cchar cshort cint cfloat csym time-----------------------------------------------------0 a 100 1000 99.9 hello world 00:00:00.2001 a 100 1000 99.9 hello world 00:00:00.2002 a 100 1000 99.9 hello world 00:00:00.200…seems to have done the trick.H?kan</stdio.h>