IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

Vous êtes nouveau sur Developpez.com ? Créez votre compte ou connectez-vous afin de pouvoir participer !

Vous devez avoir un compte Developpez.com et être connecté pour pouvoir participer aux discussions.

Vous n'avez pas encore de compte Developpez.com ? Créez-en un en quelques instants, c'est entièrement gratuit !

Si vous disposez déjà d'un compte et qu'il est bien activé, connectez-vous à l'aide du formulaire ci-dessous.

Identifiez-vous
Identifiant
Mot de passe
Mot de passe oublié ?
Créer un compte

L'inscription est gratuite et ne vous prendra que quelques instants !

Je m'inscris !

PureBasic 6.20 beta 1est disponible sur votre compte

Le , par comtois

0PARTAGES

3  0 
Hello everybody,

Christmas is near, so is the next major version of PureBasic ! This release is a major step to keep PureBasic updated and relevant for the future, with the big update of OGRE 3D (to the lastest version, including all its dependencies for all OS) and the new Windows arm64 support. It also features some highly expected commands like TLS sockets and native PureLibrary creation directly using PureBasic ! Changes:

  • Updated: OGRE 3D to lastest 14.3 version (big thanks for the help Pf Shadoko) !
  • Added: Windows 11 arm64 support !
  • Added: TLS support for Network library (Thanks Idle for the tips) !
  • Added: PureLibrary creation in PureBasic (C Backend only) !
  • Added: WebWiewProxy() to enable proxy support (Sponsored by Kukulkan)
  • Added: #PB_Editor_TabNavigation support to EditorGadget() (Sponsored by Quin)
  • Added: #PB_Entity_InheritScale support Get/SetEntityAttribute()
  • Added: DLL support to UsePostgreSQL() (Sponsored by wayne-c)
  • Added: Windows 10+ mode to link directly to UCRT.dll to have smaller executables and up-to-date CRT
  • Added: IsPack()
  • Added: PureBasic-CLI.cmd to easily open a commandline environment (Windows)


Ogre3D changes:
  • Added: Get/SetWorldAttribute() to control water and sky
  • Optimized: BuildMeshLOD() now uses a much better algorithm for automatic lod creation
  • Modified: SaveRenderTexture() -> only .png format is supported
  • Modified: reworked SkyDome() and CreateWater() fonction to have better and faster rendering
  • Modified: Add3DArchive() always needs to be after OpenScreen()
  • Modified: filenames are now case-sensitive even on Windows and OS X
  • Removed: Sun() has been removed -> replacement with CreateLight()
  • Removed: LoadWord() which was based on old BSP tech
  • Removed: WaterHeight()
  • Removed: SwitchCamera() which makes no sense


Example to create a PureLibrary
Code : Sélectionner tout
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
DisablePureLibrary Test ; Needed to avoid function conflict if the lib is already loaded
 
Global Test$
Global NewMap a()
 
Procedure InitPureLibrary()
  MessageRequester("Init","Init")
EndProcedure
 
Procedure FreePureLibrary()
  MessageRequester("End","End")
EndProcedure
 
 
;  QuickHelp  MyMax(Min [, Max [, Flags, Mode]]) - A standard min/max function
ProcedureDLL MyMax3(a, b, c, d)
  Static cc = 16
  Test$ = "Hello"
  ProcedureReturn OpenWindow(#PB_Any, 10, 10, 200, 200, "Test")
EndProcedure
 
ProcedureDLL MyMax2(a, b) ; version 2, 3, 4 .... allow to create optional parameter functions (PureBasic default values are not accepted)
  ProcedureReturn MyMax3(a, b, 0, 0)
EndProcedure
 
ProcedureDLL MyMax(a)
  ProcedureReturn MyMax2(15, 20)
EndProcedure
 
; QuickHelp GetTest() - Returns the test content
ProcedureDLL.s GetTest()
  ProcedureReturn Test$+Right(" World", 4)
EndProcedure
 
ProcedureDLL.s GetFloat(a.f, b.i, c.d)
  ProcedureReturn StrF(a) + ", "+ Str(b)+ ", "+StrD(c)
EndProcedure
 
ProcedureDLL.s GetString(a$, b$, c.d, d$)
  ; MessageRequester(a$ + b$ + c + d$, "")
  ProcedureReturn a$ + b$ + " " + c +" " + d$
EndProcedure
 
 
ProcedureDLL GetArray(Array myArray(1))
  ReDim myArray(20)
  a = myArray(3)
  ProcedureReturn ArraySize(myArray())
EndProcedure
 
ProcedureDLL GetList(List myList())
  AddElement(myList())
  AddElement(myList())
  ProcedureReturn ListSize(myList())
EndProcedure
 
ProcedureDLL GetMap(Map myMap())
  AddMapElement(myMap(), "Test")
  AddMapElement(myMap(), "Test2")
  AddMapElement(myMap(), "Test3")
  ProcedureReturn MapSize(myMap())
EndProcedure
 
ProcedureDLL.d GetDouble(a.d, b.d)
  b$ = "World"
  a$ = GetString("aaa", "bbb"+b$, 4545, b$+b$)
 
  ProcedureReturn a*b
EndProcedure
For now, it can only be compiled using the commandline, with the C backend.

On Windows, open PureBasic-CLI.cmd (On Windows arm64, use 'pbcompiler' instead of 'pbcompilerc'):

pbcompilerc LibTest.pb --purelibrary --output Test

On Linux/OSX/Raspberry, set the PUREBASIC_HOME variable to your PureBasic root installation and add $PUREBASIC_HOME/compilers to the PATH. On Linux x86 or Linux x64, use 'pbcompilerc' instead of 'pbcompiler'.

pbcompiler LibTest.pb --purelibrary --output Test

If all goes well, you should have your new library installed and after a compiler restart you should be able to test it.

There is some limitation for PureBasic purelibrary:
- No debugger support (in progress)
- All functions are compiled in the same object, which means the library will always includes all the functions in the final executable.
- No help support (in progress)

Don't hesitate to check the new 3D examples, there is some cool stuff from Pf Shadoko here !
source de l'information

Une erreur dans cette actualité ? Signalez-nous-la !

Avatar de comtois
Responsable Purebasic https://www.developpez.com
Le 12/12/2024 à 9:52
Example d'utilisation de la bibliothèque TLS.

The library used is LibreSSL. TLS server example:
Code : Sélectionner tout
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
EnableExplicit
Define.i Con, Timeout, Length
Define Receive$, Key$, Cert$, ClientID
Define *Buffer
 
Key$ = "-----BEGIN PRIVATE KEY-----"+#LF$+
       "MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBAPEbSQq/uwESZduPtDd83qXXkSPf6lUNa17xhM2fOZQxGr0Fdmvw6IsC+QGX25EE1TG6TFQkHlM2rW8y6a3WEC/WzCNWaTCPYD/rguiAFG+4eQmwHjiJFVec0InjjSG9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UEBxMEQ2l0eTEVMBMGA1UEChMMT3JnYW5pemF0aW9uMRwwGgYDVQQLExNPcmdhbml6YXRpb25hbCBVbml0MS8wLQYDVQQDEyZDb21tb24gTmFtZSAoZS5nLiwgeW91ciBzZXJ2ZXIgZG9tYWluKTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA8RtJCr+7ARJl24+0N3zepdeRI9/qVQ1rXvGEzZ85lDEavQV2a/DoiwL5AZfbkQTVMbpMVCQeUzatbzLprdYQL9bMI1ZpMI9gP+uC6IAUb7h5CbAeOIkVV5zQieONIb1JfzHBL+BB5Z1CeIpE47gOYwk7w3uZ1SF0c4NKe1d2v3MCAwEAATANBgkqhkiG9w0BAQUFAAOBgQCprm5a5bg1LqCDdtwDTnRDmVcca6HoUlvbjZLmWdLjltG1McNAATppTy/bF7vT3jXLobA1Vzs2g14POjYQhPnIbRPEnNzvAe+Se3y0YeFOwYarEyFBHKHODGIPaCnXGH8gB9fgcp2SYtLaPKvXdNL44VeYGbD4+fvUcu/zkXqTSg=="+#LF$+
        "-----END CERTIFICATE-----"
 
UseNetworkTLS(Key$, Cert$)
Con = CreateNetworkServer(#PB_Any, 20252, #PB_Network_TCP | #PB_Network_IPv4 | #PB_Network_TLSv1_3)
*Buffer = AllocateMemory(1000)
 
If Con
  Timeout = 10000
 
    Repeat
      Select NetworkServerEvent()
        Case #PB_NetworkEvent_Data
 
          Debug "Data !"
          ClientID = EventClient()
          PokeA(*Buffer, 0)
          Debug ReceiveNetworkData(ClientID, *Buffer, 1000)
 
          Debug "String: "+PeekS(*Buffer, -1, #PB_UTF8)
          SendNetworkString(ClientID, "Well received !!!")
 
        Case #PB_NetworkEvent_None
          Delay(200)
          Timeout - 1
      EndSelect
 
    Until Timeout = 0
 
    CloseNetworkServer(Con)
  Else
    Debug "Can't create the server"
EndIf
And the associated client:
Code : Sélectionner tout
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
Define.i Con, Timeout, Length
Define Receive$
Define *Buffer
 
 
UseNetworkTLS()
 
Con = OpenNetworkConnection("127.0.0.1", 20252, #PB_Network_TCP | #PB_Network_IPv4 | #PB_Network_TLSv1_3)
If Con
  *Buffer = AllocateMemory($FFFF, #PB_Memory_NoClear)
  If *Buffer
    Debug "Sending string"
    SendNetworkString(Con, "GET / HTTP/1.1" + #CRLF$ + "Host: www.purebasic.fr" + #CRLF$ + #CRLF$)
    Debug "String Sent"
    Timeout = 100
    Repeat
      Select NetworkServerEvent()
 
      EndSelect
 
      Select NetworkClientEvent(Con)
        Case #PB_NetworkEvent_Data
          Repeat
            Length = ReceiveNetworkData(Con, *Buffer, MemorySize(*Buffer))
            If Length > 0
              Receive$ + PeekS(*Buffer, Length, #PB_UTF8 | #PB_ByteLength)
            EndIf
          Until Length = 0 Or (Length > 0 And Length <> MemorySize(*Buffer))
          Break
 
        Case #PB_NetworkEvent_Disconnect
          Debug "Disconnect"
          Break
 
        Case #PB_NetworkEvent_None
          Delay(10)
          Timeout - 1
 
      EndSelect
    Until Timeout = 0
    Debug Timeout
 
    If Receive$ <> ""
      Debug Receive$
    EndIf
 
    FreeMemory(*Buffer)
  EndIf
 
  CloseNetworkConnection(Con)
Else
  Debug "can't create the client"
EndIf
0  0