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 6917601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:45:03+00:00 2026-05-27T09:45:03+00:00

Is it possible (without the use of Runtime Packages or the Shared Memory DLL)

  • 0

Is it possible (without the use of Runtime Packages or the Shared Memory DLL) to pass a Record type between the host application and a DLL module where the Record type contains Functions/Procedures (Delphi 2006 and above)?

Let’s presume for the sake of simplicty that our Record type doesn’t contain any String fields (as this of course requires the Sharemem DLL), and here’s an example:

TMyRecord = record
  Field1: Integer;
  Field2: Double;
  function DoSomething(AValue1: Integer; AValue2: Double): Boolean;
end;

So, to state this simply: can I pass an “instance” of TMyRecord between the host application and a DLL (in either direction), without the use of Runtime Packages or Shared Memory DLL, and execute the DoSomething function from both the Host EXE and the DLL?

  • 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-05-27T09:45:04+00:00Added an answer on May 27, 2026 at 9:45 am

    If I understood your question correctly, then you can do it, here’s one way to do it:

    testdll.dll

    library TestDll;
    
    uses
      SysUtils,
      Classes,
      uCommon in 'uCommon.pas';
    
    {$R *.res}
    
    procedure TakeMyFancyRecord(AMyFancyRecord: PMyFancyRecord); stdcall;
    begin
      AMyFancyRecord^.DoSomething;
    end;
    
    exports
      TakeMyFancyRecord name 'TakeMyFancyRecord';
    
    begin
    end.
    

    uCommon.pas <- used by both application and dll, unit where your fancy record is defined

    unit uCommon;
    
    interface
    
    type
      PMyFancyRecord = ^TMyFancyRecord;
      TMyFancyRecord = record
        Field1: Integer;
        Field2: Double;
        procedure DoSomething;
      end;
    
    implementation
    
    uses
      Dialogs;
    
    { TMyFancyRecord }
    
    procedure TMyFancyRecord.DoSomething;
    begin
      ShowMessageFmt( 'Field1: %d'#$D#$A'Field2: %f', [ Field1, Field2 ] );
    end;
    
    end.
    

    and finally a test application, file -> new -> vcl forms application, drop a button on the form, include uCommon.pas in the uses clause, add reference to external method

    procedure TakeMyFancyRecord(AMyFancyRecord: PMyFancyRecord); stdcall;
      external 'testdll.dll' name 'TakeMyFancyRecord';
    

    and in the button’s on click event, add

    procedure TForm1.Button1Click(Sender: TObject);
    var
      LMyFancyRecord: TMyFancyRecord;
    begin
      LMyFancyRecord.Field1 := 2012;
      LMyFancyRecord.Field2 := Pi;
      TakeMyFancyRecord( @LMyFancyRecord );
    end;
    

    DISCLAIMER:

    • works in D2010;
    • compiles on my machine!

    enjoy!


    David Heffernan’ edit

    Just to be 100% clear, the DoSomething method that is executed is the method defined in the DLL. The DoSomething method defined in the EXE is never executed in this code.


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

Sidebar

Related Questions

Is it possible to do CAD/CAM software without having to use C++? My company
1) Is it possible to use llvm-py on Windows without Visual Studio 2008? Maybe
Is it possible to use the Flex Framework and Components, without using MXML? I
Is it possible to add another icon to the dock at runtime without using
Is it possible to create and use a TClientDataSet inside an Object at runtime?
Is it possible to use the Biztalk adapter pack whithout a Biztalk installation (Biztalk
Is is possible (without external library such as boost) to prompt for input from
Is it possible without using exponentiation to have a set of numbers that when
Is it possible in IE8 without using third party plugin like Java?
Possible Duplicate: Using ASP.NET Controls without databinding My previous question yielded few results so

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.