Jump to content

Search the Community

Showing results for tags 'pascal language'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Delphi Questions and Answers
    • Algorithms, Data Structures and Class Design
    • VCL
    • FMX
    • RTL and Delphi Object Pascal
    • Databases
    • Network, Cloud and Web
    • Windows API
    • Cross-platform
    • Delphi IDE and APIs
    • General Help
    • Delphi Third-Party
  • C++Builder Questions and Answers
    • General Help
  • General Discussions
    • Embarcadero Lounge
    • Tips / Blogs / Tutorials / Videos
    • Job Opportunities / Coder for Hire
    • I made this
  • Software Development
    • Project Planning and -Management
    • Software Testing and Quality Assurance
  • Community
    • Community Management

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Delphi-Version

Found 1 result

  1. Hi to all, I've moved a lot of code from BDS2006 to Sydney and now it's time to finish DLL interfacing. Support DLLs are at moment in AnsiString so input parameters are as PAnsiChar, but overall calling code is ready to use Unicode strings (I'm waiting the right time to convert the DLL). When strings are emptied a nil pointer must be sent to DLL arguments. As a workaround I've two solutions, one fine to see but I don't know if will work in all cases. The second way could work fine always: { first mode } function StringToAnsiCPointer(const S: string): PAnsiChar; inline; function StringToAnsiCPointer(const S: string): PAnsiChar; begin if Length(S) = 0 then Result := nil else Result := PAnsiChar(AnsiString(S)); end; function CompilerEncryptFile(const TextFileName: string; Key: TCNCEncryptKey; const EncryptedFileName: string): Longint; begin Result := _CompilerEncryptFile // DLL CALL ( StringToAnsiCPointer(TextFileName), @Key, StringToAnsiCPointer(EncryptedFileName) ); end; { SECOND MODE } function CompilerEncryptFile(const TextFileName: string; Key: TCNCEncryptKey; const EncryptedFileName: string): Longint; begin Result := _CompilerEncryptFile ( IIf(Length(TextFileName) = 0, nil, PAnsiChar(AnsiString(TextFileName))), @Key, IIf(Length(EncryptedFileName) = 0, nil, PAnsiChar(AnsiString(EncryptedFileName))) ); end; My dubs in the first mode are concerning the LIFE of temporary cast to AnsiString in the line: PAnsiChar(AnsiString(S) as a result of the external function. Do you have some ideas about it?
×