Delphi-PRAXiS
Seite 1 von 2  1 2      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Programmieren allgemein (https://www.delphipraxis.net/40-programmieren-allgemein/)
-   -   Hilfe bei Steam API Wrappers (https://www.delphipraxis.net/186004-hilfe-bei-steam-api-wrappers.html)

Bubble 27. Jul 2015 07:57


Hilfe bei Steam API Wrappers
 
Hallo,

ich wollte die Steam API Wrappers mit Delphi XE6 austesten ( https://github.com/Relfos/steamworks_wrappers ), habe aber schon Probleme bei der Initialisierung. Ich glaube, einen entscheidenden Schritt vergessen zu haben. Es wäre toll, wenn mir jemand weiterhelfen könnte.

Delphi-Quellcode:
unit test;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;


Type
   MyFunction = Function(CustomUrl : PChar) : DWORD; Stdcall;
 Const
   APIload = 'steam_api.dll';
   PassString : String = 'http://forum.lazarus.freepascal.org';

var
  Form1: TForm1;

  Function SteamAPI_Init : Boolean; cdecl; External APIload; // Tried even with stdcall

implementation

{$R *.dfm}



procedure TForm1.Button1Click(Sender: TObject);
begin
  If SteamAPI_Init = True Then ShowMessage('ok');
end;

end.

Das Programmverzeichnis sieht so aus:
CSteamworks.dll
libCSteamworks.so
SteamAPI.pas
test.dfm
test.dpr
test.dproj
test.pas


Das Programm wird fehlerlos kompiliert, beim Start erscheint jedoch die Form nicht und das Programm kehrt zum Editor zurück.

baumina 27. Jul 2015 08:17

AW: Hilfe bei Steam API Wrappers
 
Projekt / Optionen / Formulare / bei Automatisch erzeugen sollte dein Formular Form1 drinstehen.

Bubble 27. Jul 2015 08:32

AW: Hilfe bei Steam API Wrappers
 
Leider nicht.

Delphi-Quellcode:
program test;

uses
  Vcl.Forms,
  test in 'test.pas' {Form1},
  SteamAPI in 'SteamAPI.pas';

{$R *.res}

begin
  Application.Initialize;
  Application.MainFormOnTaskbar := True;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.
Sicherheitshalber habe ich es nochmal neu erstellt. Es startet (Form erscheint) bis ich diese Line einfüge:

Function SteamAPI_Init : Boolean; cdecl; External APIload;

zagota 27. Jul 2015 08:59

AW: Hilfe bei Steam API Wrappers
 
[QUOTE=Bubble;1309893]Hallo,

Delphi-Quellcode:
unit test;

  Function SteamAPI_Init : Boolean; cdecl; External APIload; // Tried even with stdcall


end.
Muss bei der Definition nicht noch der Name der Funktion angegeben werden?

Function SteamAPI_Init : Boolean; cdecl; External APIload name 'SteamAPI_?????';

steam_api.dll wird auch gefunden?

cu

Bubble 27. Jul 2015 09:21

AW: Hilfe bei Steam API Wrappers
 
[QUOTE=zagota;1309898]
Zitat:

Zitat von Bubble (Beitrag 1309893)
Hallo,

Delphi-Quellcode:
unit test;

  Function SteamAPI_Init : Boolean; cdecl; External APIload; // Tried even with stdcall


end.
Muss bei der Definition nicht noch der Name der Funktion angegeben werden?

Function SteamAPI_Init : Boolean; cdecl; External APIload name 'SteamAPI_?????';

steam_api.dll wird auch gefunden?

cu

Okay, ich habe jetzt diese Line geändert:

Function SteamAPI_Init : Boolean; cdecl; External 'Steam_api.dll';

Also APIload mit 'Steam_api.dll' ersetzt.

Jetzt bekomme ich die Fehlermeldung, dass er die DLL nicht findet. Sie ist aber sowohl im System32 Verzeichnis von Windows, als auch in dem Programmverzeichnis.

Mavarik 27. Jul 2015 09:27

AW: Hilfe bei Steam API Wrappers
 
Zitat:

Zitat von Bubble (Beitrag 1309905)
als auch in dem Programmverzeichnis.

im debug Verzeichnis?

baumina 27. Jul 2015 09:27

AW: Hilfe bei Steam API Wrappers
 
Zitat:

Zitat von Bubble (Beitrag 1309893)
Das Programmverzeichnis sieht so aus:
CSteamworks.dll
libCSteamworks.so
SteamAPI.pas
test.dfm
test.dpr
test.dproj
test.pas

Zitat:

Zitat von Bubble (Beitrag 1309893)
Also APIload mit 'Steam_api.dll' ersetzt.

Jetzt bekomme ich die Fehlermeldung, dass er die DLL nicht findet. Sie ist aber sowohl im System32 Verzeichnis von Windows, als auch in dem Programmverzeichnis.

Wie heißt denn die DLL "CSteamworks.dll" oder "Steam_api.dll"?

zagota 27. Jul 2015 09:32

AW: Hilfe bei Steam API Wrappers
 
[QUOTE=Bubble;1309905]
Zitat:

Zitat von zagota (Beitrag 1309898)
Zitat:

Zitat von Bubble (Beitrag 1309893)
Hallo,

Delphi-Quellcode:
unit test;

  Function SteamAPI_Init : Boolean; cdecl; External APIload; // Tried even with stdcall


end.
Muss bei der Definition nicht noch der Name der Funktion angegeben werden?

Function SteamAPI_Init : Boolean; cdecl; External APIload name 'SteamAPI_?????';

steam_api.dll wird auch gefunden?

cu

Okay, ich habe jetzt diese Line geändert:

Function SteamAPI_Init : Boolean; cdecl; External 'Steam_api.dll';

Also APIload mit 'Steam_api.dll' ersetzt.

Jetzt bekomme ich die Fehlermeldung, dass er die DLL nicht findet. Sie ist aber sowohl im System32 Verzeichnis von Windows, als auch in dem Programmverzeichnis.

Gemeint hatte ich eigentlich

Function SteamAPI_Init : Boolean; cdecl; External 'Steam_api.dll' name 'Name der Funktion die aufgerufen werden soll';

In deinem ersten Post war die Steam_api.dll aber nicht aufgeführt.

cu

baumina 27. Jul 2015 09:37

AW: Hilfe bei Steam API Wrappers
 
Zitat:

Zitat von zagota (Beitrag 1309910)
Gemeint hatte ich eigentlich

Function SteamAPI_Init : Boolean; cdecl; External 'Steam_api.dll' name 'Name der Funktion die aufgerufen werden soll';

Wenn der Funktionsname in der DLL genauso heißt wie vorne angegeben ("SteamAPI_Init"), kann man diesen hinten (...name "Name der Funktion") weglassen.

zagota 27. Jul 2015 09:42

AW: Hilfe bei Steam API Wrappers
 
Zitat:

Zitat von baumina (Beitrag 1309912)
Zitat:

Zitat von zagota (Beitrag 1309910)
Gemeint hatte ich eigentlich

Function SteamAPI_Init : Boolean; cdecl; External 'Steam_api.dll' name 'Name der Funktion die aufgerufen werden soll';

Wenn der Funktionsname in der DLL genauso heißt wie vorne angegeben ("SteamAPI_Init"), kann man diesen hinten (...name "Name der Funktion") weglassen.

Ok, hab schon lange kein statischen Import mehr gemacht.
Würde eh über LoadLibrary() und GetProcAddress() gehen.

cu


Alle Zeitangaben in WEZ +1. Es ist jetzt 21:55 Uhr.
Seite 1 von 2  1 2      

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz