Results 1 to 3 of 3

Thread: Issues with transfering string from Delphi DLLs

  1. #1

    Issues with transfering string from Delphi DLLs

    Hi guys,

    I heard that you guys having issues with string transfer from a Delphi DLL. Delphi has it's own way of handling strings. They can be as long as you want them too. To if you want to get a pointer to a string like in C/C++, you have to transmit PChar(yourstring). I hope that helps.

    A good read about Delphi strings and how the store the content is this page:


  2. #2
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Milan - Italy
    Rep Power

    Re: Issues with transfering string from Delphi DLLs

    Thank you Michael. We will have a look.

    We have already done something for C interface passing strings.
    We have created a common way to allocate string buffers between thinCore.dll and modules developed using C passing a pointer to a buffer where the first bytes are controls flags to understand the method of buffer allocation, the owner of the buffer (Module or Core) and who is responible for deallocation (again Core or Module).

    I've already checked Turbo Delphi help file on strings. There are some different types. What I would like to have is something very close to OLE32 strings so able to store NULL bytes too. I suppose PChar is something very close to ANSI strings where a NULL byte indicate the end of the string and there is no clue of what is the real size of the allocated buffer.

    In any case, PChar will be the "escape" solution but I would like to check all the other possibilities before using it.

    Thanks a lot
    Eros | |
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  3. #3
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Naples, Florida & Duluth, Georgia
    Rep Power

    Re: Issues with transfering string from Delphi DLLs

    I read the article and still don't get it, but I did see the pchar as being the magic format for working with windows api calls it says

    Thanks Mike and Eros, Delphi is neat. It is nice to know can use both languages together to do almost anything from what I can see so far!!
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

Similar Threads

  1. Debugging of DLLs
    By ibd in forum thinBasic General
    Replies: 7
    Last Post: 20-05-2008, 21:20

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts