0

I'm having some trouble when returning symbols from C++ code. I made a small example that illustrates the problem.

We export the following function:

extern "C" __declspec(dllexport) K getSym(K x) {
    return ks((S)"sym");
}

And then call it from Q:

q)asdf:(`our_dll 2:(`getSym;1))[1]
q)asdf
`sym
q)asdf = `sym
0b
q)asdf = `$string asdf
0b
q)0N!asdf
`sym
`sym
q)(string asdf) = (string `sym)
111b

Why are the two values unequal?

This is 32-bit KDB+ 3.2.

1 Answers1

0

If you use a version of q prior to 2.4, you need to intern C string using the ss() function before passing it to ks(). You should not see this problem with the recent versions.

Alexander Belopolsky
  • 2,228
  • 10
  • 26