AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

DLL einbinden octopus.dll

Offene Frage von "multi-man"
Ein Thema von multi-man · begonnen am 22. Jul 2008 · letzter Beitrag vom 5. Aug 2008
 
multi-man

Registriert seit: 9. Jul 2008
16 Beiträge
 
Delphi 7 Professional
 
#12

Re: DLL einbinden octopus.dll

  Alt 25. Jul 2008, 01:41
Zitat von Luckie:
Zitat von multi-man:
Speicher reserviert ? Wohl eher nicht
Aber hier mal der Code :
Delphi-Quellcode:
function octopus_init(var context: octopus_context): integer; external 'octopus.dll';

function octopus_get_hwdesc(var context: octopus_context; desc: Pchar): Pchar; external 'octopus.dll';

function octopus_open(context: octopus_context): integer; external 'octopus.dll';
Bei dir fehlen überall die Aufrufkonventionen.
Danke, das ist mittlerweile behoben !


Zitat von omata:
Versuch es mal so...
Delphi-Quellcode:
type
  octopus_context = packed record
    usb_handle : integer;
    error_str : pchar;
  end;
  Poctopus_context = ^octopus_context;

function octopus_init(context: Poctopus_context): integer; stdcall; external 'octopus.dll';
function octopus_open(context: Poctopus_context): integer; stdcall; external 'octopus.dll';
Aufruf...
Delphi-Quellcode:
var context:Poctopus_context;
begin
  new(context);
  try
    if octopus_init(context) = 0 then
      raise Exception.Create(context.error_str);

    if octopus_open(context) < 0 then
      raise Exception.Create(context.error_str);

  finally
    dispose(context);
  end;
end;
Das Init läuft durch, beim Open erhalte ich die folgende Meldung: "could not found octopus device with pid and vid". Diese Meldung ist ja schonmal vielversprechend, ich habe ja auch kein Gerät. Aber es kommt eben auch keine Access Violation mehr.
Danke für den guten Ansatz, Init läuft durch mit 1 und open läuft auch durch ohne exception und mit returnwert 1, allerdings bekomme ich jetzt im error_str die Meldung "can't set configuration for given usb device" .

Das ist jetzt wohl wahrscheinlich nicht mehr delphi-spezifisch ... Habe allerdings gerade nochmal in Python an dem selben Rechner das Teil probiert, und da funktioniert es wunderbar ...

Aber der Aufruf scheint ja eigentlich zu stimmen, sonst würde ja nicht 1 und der error_str zurückkommen ...
Vielleicht stimmt an der dll was nicht ..

Ich werd mal weiter forschen ...

Falls noch jemand ne Idee hat, lasst es mich wissen
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 22:59 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz