disphelper.a FB-1.07.1-win64

External libraries (GTK, GSL, SDL, Allegro, OpenGL, etc) questions.
BasicScience
Posts: 489
Joined: Apr 18, 2008 4:09
Location: Los Angeles, CA
Contact:

disphelper.a FB-1.07.1-win64

Postby BasicScience » Dec 31, 2019 2:43

Has anyone recompiled the disphelper library for win64?

I verified the (old) win 32 bit version works with FB-1.07.1-win32.
BasicScience
Posts: 489
Joined: Apr 18, 2008 4:09
Location: Los Angeles, CA
Contact:

Re: disphelper.a FB-1.07.1-win64

Postby BasicScience » Dec 31, 2019 18:41

My prior post wasn’t very clear.

I’m trying to find disphelper.a that is compatible with FB-1.07.1-win64. Does anyone know of an available download?
dodicat
Posts: 6641
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: disphelper.a FB-1.07.1-win64

Postby dodicat » Dec 31, 2019 22:39

Do you have mingw 64 bit.
I have disphelper.c and disphelper.h
I don't have the 64 bit mingw here, but these two files can create libdisphelper.a with my 32 bit mingw, tested and working.
BasicScience
Posts: 489
Joined: Apr 18, 2008 4:09
Location: Los Angeles, CA
Contact:

Re: disphelper.a FB-1.07.1-win64

Postby BasicScience » Jan 03, 2020 0:34

Thanks for the offer. Unfortunately I don't have mingw 64 bit installed.
UEZ
Posts: 612
Joined: May 05, 2017 19:59
Location: Germany

Re: disphelper.a FB-1.07.1-win64

Postby UEZ » Apr 08, 2020 6:42

dodicat wrote:Do you have mingw 64 bit.
I have disphelper.c and disphelper.h
I don't have the 64 bit mingw here, but these two files can create libdisphelper.a with my 32 bit mingw, tested and working.


@all: How can I create that libdisphelper.a x64 file in detail? I assume it should be the same as for x86.

Can somebody please describe the steps?

Thx.
dodicat
Posts: 6641
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: disphelper.a FB-1.07.1-win64

Postby dodicat » Apr 08, 2020 11:05

Go to the news section of the forum.
Get a mingw package (if you don't have one)
Make sure the mingw bin folder is on path.

Get the disphelper source code
https://sourceforge.net/projects/disphelper/

Use the single_file_source folder for convenience
create a shell for cmd.exe

Code: Select all

shell "cmd"

put this shell.exe in the folder and run it.

then on the command line use:

Code: Select all

 gcc -c disphelper.c  (to get disphelper.o)

then

ar rcs -o libdisphelper.a   disphelper.o (to get the libdisphelper.a static lib)




OK with 32 bit mingw, and runs fine with disphelper.bi
But I had problems with mingw 64 bits at runtime freebasic.
srvaldez
Posts: 2482
Joined: Sep 25, 2005 21:54

Re: disphelper.a FB-1.07.1-win64

Postby srvaldez » Apr 08, 2020 12:20

dodicat
Posts: 6641
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: disphelper.a FB-1.07.1-win64

Postby dodicat » Apr 08, 2020 12:58

Thanks svarldez.
I get the 64 bit libdisphelper.a OK again, but there were warnings getting the .o file, as before.
The final fb test fails with things like
error in CreateObjectex - -
Class not registered
UEZ
Posts: 612
Joined: May 05, 2017 19:59
Location: Germany

Re: disphelper.a FB-1.07.1-win64

Postby UEZ » Apr 08, 2020 13:32

dodicat wrote:Go to the news section of the forum.
Get a mingw package (if you don't have one)
Make sure the mingw bin folder is on path.

Get the disphelper source code
https://sourceforge.net/projects/disphelper/

Use the single_file_source folder for convenience
create a shell for cmd.exe

Code: Select all

shell "cmd"

put this shell.exe in the folder and run it.

then on the command line use:

Code: Select all

 gcc -c disphelper.c  (to get disphelper.o)

then

ar rcs -o libdisphelper.a   disphelper.o (to get the libdisphelper.a static lib)




OK with 32 bit mingw, and runs fine with disphelper.bi
But I had problems with mingw 64 bits at runtime freebasic.


Thanks for you instruction.

For x86 it works. I downloaded MinGW64 from here https://sourceforge.net/projects/mingw-w64/ and the libdisphelper.a was created but also not working.

Error: ...\freebasic64\bin\win64\ld.exe: skipping incompatible c:\...\freebasic64\lib\win64/libdisphelper.dll.a when searching for -ldisphelper

Maybe it isn't x64 generated...
dodicat
Posts: 6641
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: disphelper.a FB-1.07.1-win64

Postby dodicat » Apr 08, 2020 13:46

I suspect that the source code for disphelper is for 32 bit but gcc 64 bit manages to compile it but the warnings tell that all is not well.
For instance I think that it truncates some LONGLONG values
e.g.
static const ULONGLONG FILE_TIME_VARIANT_OVERFLOW = 2650467744000000000
I think gcc 64 bit sees this a long, not long long.
I'll have a google around for pukka 64 bit disphelper.c code.

Your error suggests you are using the wrong fb compiler, and that you are using .dll instead of .a library.
UEZ
Posts: 612
Joined: May 05, 2017 19:59
Location: Germany

Re: disphelper.a FB-1.07.1-win64

Postby UEZ » Apr 09, 2020 6:48

I succeeded to compile disphelper as x64 static library using DEV-C++.

Here the download link: https://www.mediafire.com/file/ewhfe6b2 ... 4.zip/file

I've tested with SAPI voice and it worked properly as x64 compiled exe.

Can you please test, too?

Thanks.
dodicat
Posts: 6641
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: disphelper.a FB-1.07.1-win64

Postby dodicat » Apr 09, 2020 8:20

UEZ
I don't have a sapi voice example to test.
Here is my test file (four routines).

Code: Select all

 

#define UNICODE
#include Once "disphelper/disphelper.bi"
Dim shared as IDISPATCH PTR VB_FB
dhInitialize(TRUE)
dhToggleExceptions(True)
dhCreateObject "MSScriptControl.ScriptControl",NULL,@VB_FB
dhPutValue VB_FB,".Language %s","VBScript"

Sub _END()
    SAFE_RELEASE(VB_FB)
    dhUninitialize True
End Sub
    enum 'for messagebox
    ok
    okcancel
    abortretryignore
    yesnocancel
    yesno
    retrycancel
    'icons
    critical =16
    question=32
    exclamation=48
    information=64
    end enum
'========== SETUP a few routines =======================
Function FindAndReplace(S as string,F as string,R as string)as string
    Dim Ret as zstring ptr
    dhGetValue "%s",@Ret,VB_FB,".Eval %s","Replace("""+S+""","""+F+""","""+R+""")"
    Return *Ret
End Function

Function eval(s As String) As Double
    Dim value As Zstring Ptr
    dhGetValue "%s",@value,VB_FB,".Eval %s",s
    Return Val(*value)
End Function

function MsgBox(s as string,title as string="",enums as integer=0) as integer
    Dim value As Zstring Ptr
    dhGetValue "%s",@value,VB_FB,".Eval %s","MsgBox("""+s+""","""+str(enums)+""","""+title+""")"
    Return 0
end function

function VBround(s as string,n as string) as string
    dim value as zstring ptr
    dhGetValue "%s",@value,VB_FB,".Eval %s","round("""+s+""","""+n+""")"
    return *value
end function

Dim As String e,g,laste
Dim As Double v
Dim As Double minx,maxx,miny,maxy,stp

Screen 20
Do
 
    Cls
    minx=1e20
    maxx=-1e20
    locate 1,1
    print "Example of a function in x  sin(x)*cos(x)"
    Locate 5,8
    print "Previous function ";laste
    print "Enter <enter> to use previoys function"
    locate 10
    Input "Enter a math function in x       ";e
     if len(e)=0 then e=laste
    e=lcase(e)
   
    print "Chosen function ";e
    Locate ,10
    Input "Enter x axis range  e.g.   -4,7   ",minx,maxx
    stp=(maxx-minx)/1000 
      dim as double t=timer
    For n As Single=minx To maxx Step stp
        g= FindAndReplace(e,"x",Str(n))
        If Instr(g,"e")=0 Then v=eval(g)
        If miny>v Then miny=v
        If maxy<v Then maxy=v
    Next
    maxy=1.05*maxy
    miny=1.05*miny
   
    Window(minx,miny)-(maxx,maxy)
   
    For n As Single=minx To maxx Step stp
        g= FindAndReplace(e,"x",Str(n))
        If Instr(g,"e")=0 Then
            v=eval(g)
            If n=minx Then Pset(n,v) Else Line -(n,v)
        End If
    Next
    If minx<0 And maxx>0 Then Line(0,maxy)-(0,miny),4
    If miny<0 And maxy>0 Then Line(minx,0)-(maxx,0),4 
    Window
    Draw String(500,0),Str(maxy)
    Draw String(500,768-16),Str(miny)
    Draw String(0,768\2),Str(minx)
    Draw String(1024-8*Len(Str(maxx)),768\2),Str(maxx)
    locate 15,15
    print timer-t
    laste=e
    Sleep
    If Inkey=Chr(27) Then Exit Do
Loop
End
 

Unfortunately I get the same errors with your file.
UEZ
Posts: 612
Joined: May 05, 2017 19:59
Location: Germany

Re: disphelper.a FB-1.07.1-win64

Postby UEZ » Apr 09, 2020 8:27

Hmmm.

Here the SAPI code I'm using which works for x64:

Code: Select all

'Coded by UEZ build 2020-04-09 beta

#include once "disphelper\disphelper.bi"
#include once "windows.bi"

#Define UNICODE
Dim Shared As IDispatch Ptr __oTTS
Dim Shared As Ubyte __SAPIver

Enum SpeechVoiceSpeakFlags
    SVSFDefault = 0
    SVSFlagsAsync = 1
    SVSFPurgeBeforeSpeak = 2
    SVSFIsFilename = 4
    SVSFIsXML = 8
    SVSFIsNotXML = 16
    SVSFPersistXML = 32

    'Normalizer Flags
    SVSFNLPSpeakPunc = 64

    'TTS Format
    SVSFParseSapi = 128
    SVSFParseSsml = 256
    SVSFParseAutoDetect = 0

    'Masks
    SVSFNLPMask = 64
    SVSFParseMask = 384
    SVSFVoiceMask = 127
    SVSFUnusedFlags = -128
End Enum

Private Function __Disphelper_Init(sClassname As String) As IDispatch Ptr
   Dim As Wstring * 128 classname = sClassname
   DISPATCH_OBJ(oClass)
   dhInitialize(TRUE)
   dhToggleExceptions(TRUE)
   Dim As HRESULT result = dhCreateObject(@classname, NULL, @oClass)
   If result <> 0 Then Return 0
   Return oClass
End Function

Function SAPI_Init() As BOOL
   __oTTS = __Disphelper_Init("SAPI.SpVoice") 'try SAPI 5
   If __oTTS = 0 Then
      __oTTS = __Disphelper_Init("Speech.VoiceText") 'otherwise try SAPI 4
      If __oTTS = 0 Then Return FALSE
      __SAPIver = 4
   Else
      __SAPIver = 5
   End If
   Return TRUE
End Function

Sub SAPI_Close()
   SAFE_RELEASE(__oTTS)
   dhUninitialize(TRUE)
End Sub

Sub Speak(Byref Text As String, Flag As Integer = SVSFDefault)
   Dim As Wstring * 512 txt = Text
   If __SAPIver = 4 Then 'not tested!
      Dim As Bool bIsSpeaking = TRUE
      dhPutValue(__oTTS, ".Enabled = %b", TRUE)
      dhCallMethod(__oTTS, ".Speak(%S, %d)", @txt, Flag)
      While bIsSpeaking = TRUE And dhGetValue("%b", @bIsSpeaking, __oTTS, ".IsSpeaking") = 0
         Sleep(150)
      Wend
   Else
      dhCallMethod(__oTTS, ".Speak(%S, %d)", @txt, Flag)
   End If
End Sub

Sub SAPI_ChangeVoice(VoiceNumber As Ubyte = 0)
   Dim As Integer count
   DISPATCH_OBJ(oVoices)
   DISPATCH_OBJ(oItem)
   dhGetValue("%o", @oVoices, __oTTS, ".getvoices")
   dhGetValue("%d", @count, oVoices, ".count")
   VoiceNumber = Iif(VoiceNumber < 0, 0, Iif(VoiceNumber > count, count, VoiceNumber))
   dhGetValue("%o", @oItem, oVoices, ".item(%d)", VoiceNumber)
   dhPutRef(__oTTS, ".voice=%o", oItem)
End Sub

Sub SAPI_PrintVoices()
   Dim As Integer count
   DISPATCH_OBJ(oVoices)
   dhGetValue("%o", @oVoices, __oTTS, ".getvoices")
   dhGetValue("%d", @count, oVoices, ".count")
   Dim As Zstring Ptr text
   For i As Ubyte = 0 To count - 1
      dhGetValue("%s", @text, oVoices, ".item(%d).getdescription", i)
      ? i & ". " & text[0]
   Next
End Sub

Sub SAPI_SetRate(Rate As Byte = 0) '-10 to 10
   dhPutValue(__oTTS, ".rate=%d", Rate)
End Sub

Sub SAPI_SetVolume(volume As Ubyte) '0 - 100
   dhPutValue(__oTTS, ".volume=%d", volume)
End Sub

'EXAMPLE
#include once "SAPI.bi"

If SAPI_Init() = False Then ? "Unable to initialize SAPI!" : Sleep : End

? "SAPI ver: " & __SAPIver
?

? "Voices found:"
SAPI_PrintVoices()

SAPI_SetVolume(100)

? : ?

Dim As String text = "This is a SAPI voice test coded by UEZ in April 2020"
? text
Speak(text)

SAPI_ChangeVoice(2)
Text = "The voice has been change to a female voice"
? text
Speak(text)


SAPI_SetRate(-10)
Text = "Speaking very slowy"
SAPI_ChangeVoice(1)
? text
Speak(text)

?
? "The End."

SAPI_Close()
Sleep(2000) 'wait 2 seconds before closing the cmd window
End


The output:

Code: Select all

SAPI ver: 5

Voices found:
0. Microsoft David Desktop - English (United States)
1. Microsoft Hazel Desktop - English (Great Britain)
2. Microsoft Zira Desktop - English (United States)


This is a SAPI test coded by UEZ in April 2020
The voice has been change to a female voice
Speaking very slowy

The End.


I assume that the 64 bit version of the MS scriptcontrol doesn't exist.
Last edited by UEZ on Apr 09, 2020 12:15, edited 3 times in total.
dodicat
Posts: 6641
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: disphelper.a FB-1.07.1-win64

Postby dodicat » Apr 09, 2020 9:26

UEZ
Your sapi works fine.
There seems to be a hiccup with "MSScriptControl.ScriptControl" (as you suggest) in 64 bits.
I'll have a mess around.
When you compiled with dev c++ for a static lib did you get any warnings?
UEZ
Posts: 612
Joined: May 05, 2017 19:59
Location: Germany

Re: disphelper.a FB-1.07.1-win64

Postby UEZ » Apr 09, 2020 9:36

dodicat wrote:UEZ
Your sapi works fine.
There seems to be a hiccup with "MSScriptControl.ScriptControl" (as you suggest) in 64 bits.
I'll have a mess around.
When you compiled with dev c++ for a static lib did you get any warnings?


No errors:

Code: Select all

Compilation results...
--------
- Errors: 0
- Warnings: 0
- Output Filename: C:\...\Coding\C\_UEZ\Disphelper\Disphelper.a
- Output Size: 30,056640625 KiB
- Compilation Time: 0,30s


Maybe you can use Tablacus Script Control 64 for x64 execution -> https://tablacus.github.io/scriptcontrol_en.html

Return to “Libraries”

Who is online

Users browsing this forum: No registered users and 2 guests