Passing parameters from Delphi 5 to Delphi DLL XE

Posted on 2011-10-27
Last Modified: 2013-11-23
which is the correct way to pass parameters to an application in Delphi 5 to Delphi dll XE, as does the conversion from one application to another. and also because I want to use the DLL that contains forms and that such behavior within the main application (Delphi 5) as a MDIChild.
Question by:fcobanda

    Author Comment

    excuse my English
    LVL 32

    Expert Comment


    What exactly do you mean by correct way of passing parameters?

    If you want to pass strings use PWideChar

    You can pass records, pointers and any other simple data structures

    For forms, just call the function in the dll that opens the form

    Author Comment


    have some sample code, how should I send the parameter and as I have the code in the DLL?, if possible, any additional comment PARAMETER classes who told me.

    LVL 32

    Expert Comment


    what is the signature of the function in the dll you need to call?


    Author Comment


    main application
    function Modulo_Pptos_Operacion(No_Orden : Integer; pathBD : string; PathBDConf : String) : Integer ; stdcall;
     external 'LIB_Pptos_Oper.dll';

       DmDatos.CiasPATHA.Value, PathDBConfig);

    and must be declared in the DLL for you to pass parameters correct?
    So I have it now

    Modulo_Pptos_Operacion function (No_Orden: Integer; PathDB: String; PathDBConfig: String): Integer; StdCall;

    LVL 25

    Accepted Solution


    Because Delphi Xe String <> Delphi 5 String, better is using pointers.
    You must recompile dll with declaration in it:

    Modulo_Pptos_Operacion function (No_Orden: Integer; PathDB: PChar; PathDBConfig: PChar): Integer; StdCall;


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
    Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
    This video discusses moving either the default database or any database to a new volume.
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now