Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

dll problem...

dolev9dolev9 Posts: 147Member
hello there

i have met a strange thing over the tp7 of mine.
when i want to creat a dll file as i know instead of writing
"program" or "unit" i should write "library"(as i seen in few sites and in the tp help section), but when i do it, it writes an error -"begin exprected" like it does not meet this word, althought when i write this word it brights in white as every reserved word.

what should i do to make it build a dll?

thanks
dolev


Comments

  • geergongeergon Posts: 11Member
    : hello there
    :
    : i have met a strange thing over the tp7 of mine.
    : when i want to creat a dll file as i know instead of writing
    : "program" or "unit" i should write "library"(as i seen in few sites and in the tp help section), but when i do it, it writes an error -"begin exprected" like it does not meet this word, althought when i write this word it brights in white as every reserved word.
    :
    : what should i do to make it build a dll?
    :
    : thanks
    : dolev
    :
    :
    :
    Hello!

    Rebember that Tp is a subset of the called Borland Pascal with Objects,
    Actually you can not use a dll in the called real mode, this tool,
    the Borland Pascal with Object, has the ability to create DPMI, DLLs, and windows apps.
    You have to set the target in order to compile the dll, in the compile menu, to DPMI or windows aplication. TP does not have this options.
    Also try borland pascal for windows 1.5.

    [code]
    library MinMax;

    {The export procedure directive prepares Min and Max for exporting}

    function Min(X, Y: Integer): Integer; export;
    begin
    if X < Y then Min := X else Min := Y;
    end;

    function Max(X, Y: Integer): Integer; export;
    begin
    if X > Y then Max := X else Max := Y;
    end;

    {The exports clause actually exports the two routines, supplying an
    optional ordinal number for each of them}

    exports
    Min index 1,
    Max index 2;

    begin
    end.

    [blue]Time to use it!!![/blue]

    program test; (*compiled in DMPI mode*);
    var num1,num2:integer;

    function Max(X, Y: Integer): Integer; far; external 'MinMax' index 2;

    begin
    writeln ('I am using the minmax dll library');
    writeln ('Enter the firts number:');
    readln (num1);
    writeln ('Enter the second number:');
    readln (num2);
    writeln ('The max number is:',max(num1,num2));
    end.
    [/code]
    Sorry English is not my native language
    Thank you for your time
    Att: George.
  • dolev9dolev9 Posts: 147Member
    thx george for the help

    dolev
Sign In or Register to comment.