Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8190573
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T03:42:08+00:00 2026-06-07T03:42:08+00:00

Since I’ve upgraded from delphi 5 to XE I’m struggling to use specific Dlls

  • 0

Since I’ve upgraded from delphi 5 to XE I’m struggling to use specific Dlls that were compiled a while ago. My blocking point seems related to the unicode/ansi character but I haven’t found out how to solve the problem

Here is an example of procedure:

procedure GetFilename(Buffer: PChar; BufSize: Integer); stdcall;

In my code I’m calling this that way

implementation    
procedure GetFilename; external 'myDll.dll' name 'GetFilename';
procedure myproc
var
  buffer : Array [0..255] of Char;
begin
  GetFilename(buffer, length(buffer)-1);
  Showmessage(buffer); //This gives me chinese character
end; 

Buffer contains this:

byte((@buffer[0])^); // 67 which is the ASCII for C
byte((@buffer[1])^); // 92 which is the ASCII for \

what I’m expecting normal is a string starting with “C:\”

Has anyone faced the same problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T03:42:10+00:00Added an answer on June 7, 2026 at 3:42 am

    Because the dll was made using a non-Unicode version of Delphi you must change the declaration from

    procedure GetFilename(Buffer: PChar; BufSize: Integer); stdcall;
    

    to

    procedure GetFilename(Buffer: PAnsiChar; BufSize: Integer); stdcall;
    

    and the buffer variable from

    buffer : Array [0..255] of Char;
    

    to

    buffer : Array [0..255] of AnsiChar;
    

    Additionally to learn about the Delphi Unicode support take a look to the Delphi and Unicode Whitepaper from Marco Cantú.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Since input and raw_input() stop the program from running anymore, I want to use
Since REST is stateless, each request that comes in has no knowledge of the
Since now I have only used plugin for editing and the way I use
Since I use revision 54 instead of revision 48 I get this excetption in
Since i upgraded my store to 1.7, i can't create new categories and also
Since a few years, common sense seems to dictate that it's better to program
Since i discovered the concept of non-blocking scripts i have become obsessed with loading
Since named parameters are those parameters that are identified by their explicit name, instead
Since no other topics uses the script I use, I need serious help. I
Since SQL Server Express is free to use, If I install two instances of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.