AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Suchfunktion Ergebnis der Suchanfrage

Ergebnis der Suchanfrage


Datum des Suchindex: Heute, 09:32

Parameter dieser Suchanfrage:

Suche in Thema: How to - string in DLL
Suche alle Beiträge, die von "WojTec" geschrieben wurden
• Suchmethode: "Suche nach allen Begriffen"
• Nach Datum (firstpost) sortiert
• Zeige Treffer als Beiträge
Zeige 10 von insges. 10 Treffern
Suche benötigte 0.002s

Es liegen Ergebnisse in folgenden Bereichen vor:

  • Forum: Object-Pascal / Delphi-Language

    Re: How to - string in DLL

      Delphi
      by WojTec, 22. Jun 2011
    Hm, my functions working as in example on 1st page in this thread, size is length of S, in Ansii should be S length, but in Unicode length * 2 if we talking about bytes nor string length, but the same code working if both EXE and DLL are Ansii OR Unicode. So, what I should to do?
  • Forum: Object-Pascal / Delphi-Language

    Re: How to - string in DLL

      Delphi
      by WojTec, 22. Jun 2011
    There is another problem - compatibility Ansii/Unicode.
    DLL is compiled with D2010, it uses unit with string type.
    In API unit I strings declared as AnsiString:

    S: AnsiString;
    S := FuncReturnsString();
    StrLCopy(lpBuffer, PAnsiChar(AnsiString(S)), nSize) // second typecast is from old version

    If both DLL and app are compiled in Ansii compiler (D7) - it working, if in Unicode (D2010) -...
  • Forum: Object-Pascal / Delphi-Language

    Re: How to - string in DLL

      Delphi
      by WojTec, 20. Jun 2011
    Thanks guys, you helped me so much! :D
  • Forum: Object-Pascal / Delphi-Language

    Re: How to - string in DLL

      Delphi
      by WojTec, 20. Jun 2011
    Oh gosh, I forgot add stdcall before external in app. Ah :( Now working! Thanks :D

    Also a few of you told that better is using WideChar. I tried this:

    // In DLL

    function FooncUni(Data: WideString): WideString; stdcall;
    var
    S: string;
    begin
  • Forum: Object-Pascal / Delphi-Language

    Re: How to - string in DLL

      Delphi
      by WojTec, 20. Jun 2011
    DLL:
    library StringDLL;

    uses
    SysUtils;

    function Foonction(Data: PWideChar; Buffer: PWideChar; lenBuffer: Cardinal): Cardinal; stdcall;
    var
    S: string;
    begin
  • Forum: Object-Pascal / Delphi-Language

    Re: How to - string in DLL

      Delphi
      by WojTec, 19. Jun 2011
    library StringDLL;

    uses
    SysUtils;

    function Foonction(Data: PWideChar; Buffer: PWideChar; lenBuffer: Cardinal): Cardinal; stdcall;
    var
    S: string;
    begin
    S := 'foo' + Data;
  • Forum: Object-Pascal / Delphi-Language

    Re: How to - string in DLL

      Delphi
      by WojTec, 19. Jun 2011
    Code (function from @Luckie article).

    library StringDLL;

    uses
    SysUtils;

    function func1(s: PWideChar; Buffer: PWideChar; lenBuffer: Integer): Integer; stdcall;
    var
    foo: String;
  • Forum: Object-Pascal / Delphi-Language

    Re: How to - string in DLL

      Delphi
      by WojTec, 19. Jun 2011
    I tested @Luckies code and it working in example, but don't work in this case:


    function func1(s: PChar; Buffer: PChar; lenBuffer: Integer): Integer; external 'StringDLL.dll';

    var
    Buffer: array of Char;
    BufferSize: DWORD;
    begin
    BufferSize := High(Buffer);
  • Forum: Object-Pascal / Delphi-Language

    Re: How to - string in DLL

      Delphi
      by WojTec, 17. Jun 2011
    Thanks @Luckie!

    Can I ask for example how to use functions @himitsu listed? Or just use WideString as Delphi's string?
  • Forum: Object-Pascal / Delphi-Language

    How to - string in DLL

      Delphi
      by WojTec, 16. Jun 2011
    This is the bigest problem I currently have: how to use strings in DLL.

    I know have to use PChar in exports. How about internal code that operates on Delphi's strings? I want to share this DLL with any language, so I can't use external memory manager (as I did with DLLs that can be used by my software only). For example function returns string or parameter is string or variable or constant is...


URL zu dieser Suchanfrage:

https://www.delphipraxis.net/dp_search.php?do=usersearch&search_username=WojTec&search_exact_username=1&search_sortby=dateline&search_resulttype=post&search_matchmode=0&searchthreadid=161104
Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 09:43 Uhr.
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