Jump to content

Search the Community

Showing results for tags 'parameter'.



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. I have created a DLL with one exported function using the latest version of Delphi (12.1). The function takes one parameter: a record type variable. library MyDLL; uses System, SysUtils; type TMyRecord = record MyString: AnsiString; MyInteger: Integer; end; function FillRecord(var Rec: TMyRecord): Boolean; stdcall; export; begin Rec.MyString := 'Hello from Delphi'; Rec.MyInteger := 42; Result := True; end; exports FillRecord; begin end. In my C++ Builder 6.0 application, I have declared the following: struct TMyRecord { char *MyString; int MyInteger; }; extern "C" __declspec(dllimport) bool __stdcall FillRecord(TMyRecord *Rec); When calling the 'FillRecord' function from my C++ Builder application, I do not get the expected results: TMyRecord iMyRec; Memo1->Lines->Clear(); Memo1->Lines->Add(Format("Address: %p", ARRAYOFCONST((&iMyRec)))); if (FillRecord(&iMyRec)) { String iData = iMyRec.MyString; Memo1->Lines->Add("iMyRec.MyString: " + iData); int iNumber = iMyRec.MyInteger; Memo1->Lines->Add("iMyRec.MyInteger: " + IntToStr(iNumber)); } else { Memo1->Lines->Add("Error calling FillRecord"); } I am expecting: iMyRec.MyString: Hello from Delphi iMyRec.MyInteger: 42 But I am getting: iMyRec.MyString: H iMyRec.MyInteger: 42 I am drawing a blank when trying to figure out what I am doing wrong. Any inputs/suggestions to solve my issue would be greatly appreciated. Thank you
×