cstatisticslibrariesvlang

How to use C libraries in Vlang for basic statistics


I want to do basic statistics with Vlang.

Can I use C libraries? For example, Apophenia: http://apophenia.info/

Or IMSL C stat library: https://docs.roguewave.com/en/imsl/c/8.6/pdf/C_Stat_library.pdf

Thanks for your help.


Solution

  • Yes, you can call C libraries from V.

    You need to make the C library's structs, typedefs and functions known to V by defining them in V first - before calling/using them.

    For structs you conveniently only need to define the fields you need to use.

    Here's some examples:

    Generally you can find a lot of C wrapper code in vlib itself. (We're working on replacing C with pure V)