ta-lib icon indicating copy to clipboard operation
ta-lib copied to clipboard

Missing TA_GetVersionString function in Windows DLL

Open Youngv opened this issue 11 months ago • 6 comments

Description: I found that the TA_GetVersionString function is missing in the Windows DLL (ta-lib.dll). This function is available in other platforms (Linux/macOS) but seems to be missing in the Windows build.

Steps to reproduce:

  1. Install TA-Lib on Windows
  2. Try to call TA_GetVersionString function through FFI
  3. Get Fiddle::DLError indicating the function is not found

Environment:

  • OS: Windows
  • Ruby version: 3.x
  • TA-Lib version: ta-lib-0.6.4-windows-x86_64.msi

Expected behavior:

  • TA_GetVersionString should be available in Windows DLL like other platforms

Actual behavior:

  • Function is missing in Windows DLL
  • Causes FFI binding to fail when trying to load this function

Would it be possible to include this function in the Windows build as well for consistency across platforms?

Youngv avatar Jan 20 '25 12:01 Youngv

Thanks for reporting an issue.

Is there any other function working, or the problem is specific to TA_GetVersionString()? As an example, is TA_Initialize() working?

(I am wondering because TA_GetVersionString is exported in same way as the rest of the API on windows).

mario4tier avatar Jan 20 '25 18:01 mario4tier

Yes, other functions are working correctly. For example:

  • TA_Initialize()
  • TA_Shutdown()
  • TA_GroupTableAlloc()
  • All indicator functions (SMA, EMA, MACD, etc.)

The issue seems to be specific to TA_GetVersionString().

I'm using Ruby FFI (Fiddle) to bind the functions and have already created a gem ta_lib_ffi. Here's my extern declaration:

require "fiddle"
require "fiddle/import"

# Ruby FFI wrapper for TA-Lib (Technical Analysis Library)
module TALib
  VERSION = "0.1.0"

  extend Fiddle::Importer

  lib_path = case RUBY_PLATFORM
             when /darwin/
               brew_prefix = `brew --prefix`.chomp
               "#{brew_prefix}/lib/libta-lib.dylib"
             when /linux/
               "libta-lib.so"
             when /cygwin|mswin|mingw|bccwin|wince|emx/
               "C:/Program Files/TA-Lib/bin/ta-lib.dll"
             else
               raise "Unsupported platform"
             end

  dlload lib_path

  extern "const char TA_GetVersionString(void)"
  extern "int TA_Initialize()"
  extern "int TA_Shutdown()"
  extern "int TA_GroupTableAlloc(TA_StringTable**)"
  extern "int TA_GroupTableFree(TA_StringTable*)"
end

Youngv avatar Jan 21 '25 06:01 Youngv

TA_GetVersionString() returns a pointer.

Try replacing: extern "const char TA_GetVersionString(void)" with: extern "const char *TA_GetVersionString(void)"

mario4tier avatar Jan 21 '25 20:01 mario4tier

@Youngv that's a really cool project, I love the Ruby bindings.

If you get interested, we'd love to link it or fork it in the https://github.com/ta-lib organization!

mrjbq7 avatar Jan 21 '25 20:01 mrjbq7

@Youngv an invite has been sent.

You can also move your existing repos in the org (like we did for ta-lib-python and ta-lib core). You will then benefit from a lot more visibility/visitors. You still keep all the stars and control of your repos (and it still shows in your profile).

Also, it makes some CI easier (e.g. https://ta-lib.org/install is automatically updated when there is a new TA-Lib core release).

If you want to talk more directly, consider joining us on Discord: https://discord.com/invite/Erb6SwsVbH

mario4tier avatar Jan 21 '25 20:01 mario4tier

@mario4tier I tried replacing the declaration with extern "const char *TA_GetVersionString(void)", but the issue persists. I used DLL Export Viewer to check the DLL, and it seems that TA_GetVersionString is not exported. Thank you for the invitation! I have a few concerns I’d like to discuss. I'll reach out on Discord soon.

Youngv avatar Jan 22 '25 03:01 Youngv