KX Community

Find answers, ask questions, and connect with our KX Community around the world.
KX Community Guidelines

Home Forums kdb+ Can’t recognise khpun, khp functions…

  • Can’t recognise khpun, khp functions…

    Posted by hzadonis369 on July 18, 2023 at 12:00 am

    I’m using the new kdb package which downlaod from Github(https://github.co/KxSystems/kdb), it has the C API interface to convert data into K type.

    While I write code in Visual Studio and try to compile it, there’re error message. Such as: can’t recognize khpun, khp function.

    hzadonis369 replied 9 months ago 2 Members · 6 Replies
  • 6 Replies
  • davidcrossey

    Member
    July 18, 2023 at 12:00 am

    Did you compile your code and link against the c.o object file too? Check out kdb/l64/c.o at master KxSystems/kdb GitHub If you need a different OS binary, check out the directories at the root of the repo.

    More info here: C/C++ | Interfaces | kdb+ and q documentation – Kdb+ and q documentation (kx.com)

    • hzadonis369

      Member
      July 18, 2023 at 12:00 am

      Thanks, My OS is Win10 64bit.

      I’m reading the doc(https://code.kx.com/q/wp/capi/#creating-a-simple-list-object) and want to copy sample code into my Visual Studio env. But why I can’t find the “common.h” file?

      • davidcrossey

        Member
        July 18, 2023 at 12:00 am

        Have you included the k.h header file in your code?

        There is a good whitepaper from  using the capi you can follow here

        • hzadonis369

          Member
          July 18, 2023 at 12:00 am

          Thanks davidcrossey. I had included the k.h in my cpp file.

          It seems khpun function in k.h can’t be invoked.

  • hzadonis369

    Member
    July 18, 2023 at 12:00 am

    I did test based on the source code from Github, for example the portopen.c, common.h, k.h

    But error message reports at my Visual Studio env: E0167 “const char *”   “S”

    Does the k.h works fine at Win10 64bit env?

  • davidcrossey

    Member
    July 19, 2023 at 12:00 am

    Yes it can be used on w64, however there are differences in terms of the libraries needed for linking: kdb/w64 at master KxSystems/kdb (github.com)

    This repo: kxcontrib/capi (github.com) only supports Linux based environments. You could fork it and add Windows support yourself, or a more straight forward solution would be to setup WSL2 with a *nix distribution (such as Ubuntu), and use that environment for your local development – works with VS Code.

Log in to reply.