Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem access the vosk API ".dll" and ".so" with Delphi 11.2 under Windows 11. #1736

Open
lucarnet opened this issue Apr 2, 2025 · 0 comments

Comments

@lucarnet
Copy link

lucarnet commented Apr 2, 2025

Hello,
I can't access the vosk API "libvosk.dll" with Delphi 11.2 under Windows 11.
The problem is the same with the ".so" library for compiling to Android with Delphi.
The access tests to the DLL (vosk_model_new) are OK in C under VSCode.
Question: Is the Windows DLL (et.so) library configured in the stdcall required for Delphi?
Do you have any other ideas, or is it possible to modify the library ".dll" and ".so" repo for program delphi/Windows?
Thanks.

===========================================
The Delphi header unit "vosk_api.pas":
(compilation/linking are fine, but the call to "vosk_model_new" is always = nil)
I created an intermediate DLL to correct, if necessary, a problem converting pansichar
to a string "0terminal", but the result is also negative.

unit vosk_api;
{ This unit is automatically generated by Chet:
  https://github.com/neslib/Chet }

{$MINENUMSIZE 4}

interface

const
  {$IF Defined(WIN32)}
  LIB_VOSK = 'libvosk.dll';
  _PU = '';
  {$ELSEIF Defined(WIN64)}
  LIB_VOSK = 'libvosk.dll';
  _PU = '';
  {$ELSE}
    {$MESSAGE Error 'Unsupported platform'}
  {$IFEND}

type
  PVoskModel = Pointer;
  PPVoskModel = ^PVoskModel;
  PVoskSpkModel = Pointer;
  PPVoskSpkModel = ^PVoskSpkModel;
  PVoskRecognizer = Pointer;
  PPVoskRecognizer = ^PVoskRecognizer;
  PVoskBatchModel = Pointer;
  PPVoskBatchModel = ^PVoskBatchModel;
  PVoskBatchRecognizer = Pointer;
  PPVoskBatchRecognizer = ^PVoskBatchRecognizer;

(** Loads model data from the file and returns the model object
 *
 * @param model_path: the path of the model on the filesystem
 * @returns model object or NULL if problem occured *)
function vosk_model_new(const model_path: PAnsiChar): PVoskModel; cdecl;
  external LIB_VOSK name _PU + 'vosk_model_new';
...

==========================================
le contenu de la dll:

D:\Outils\Dev\vosk\vosk-win64-0.3.45>dir
 Le volume dans le lecteur D s’appelle DATA
 Le numéro de série du volume est 7095-7215

 Répertoire de D:\Outils\Dev\vosk\vosk-win64-0.3.45

11/03/2025  17:59    <DIR>          .
26/03/2025  12:02    <DIR>          ..
11/03/2025  17:59           606 425 libgcc_s_seh-1.dll
11/03/2025  17:59        26 619 146 libstdc++-6.dll
11/03/2025  17:59        26 447 872 libvosk.dll
11/03/2025  17:59        16 230 308 libvosk.lib
11/03/2025  17:59           366 907 libwinpthread-1.dll
11/03/2025  17:59            12 445 vosk_api.h
               6 fichier(s)       70 283 103 octets
               2 Rép(s)  461 917 831 168 octets libres

D:\Outils\Dev\vosk\vosk-win64-0.3.45>nm libvosk.dll
nm: libvosk.dll: no symbols

D:\Outils\Dev\vosk\vosk-win64-0.3.45>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant