Recent

Author Topic: How to compile an existing dll ?  (Read 2503 times)

440bx

  • Hero Member
  • *****
  • Posts: 3944
How to compile an existing dll ?
« on: February 16, 2019, 10:06:26 am »
Hello,

If I needed proof that I am a Lazarus noobie, I just got it... <chuckle>.

Here is the situation:

I have a program named "MyProg.lpr", everything works as expected when I open that lpr file in Lazarus.

I also have a dll named "MyProgDll.lpr" in the same directory.  When I open it with Lazarus, Lazarus shows the entire file as if every line is a comment.   If I try to compile "MyProgDll.lpr", Lazarus compiles "MyProg.lpr" instead.

The obvious question is: how do I get Lazarus to compile my DLL ?  (note, this is existing code I'm porting from Delphi 2 - I've been tempted to tell Lazarus to start a new "Library" and cut and paste from the current file to the file created by Lazarus but, there must be a less pedestrian way of getting Lazarus to compile an existing dll.)

Thank you for your help.

ETA:

I figured out what was happening.  Ignore this post.  I tried to delete it but I wasn't allowed to.
« Last Edit: February 16, 2019, 10:34:16 am by 440bx »
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: How to compile an existing dll ?
« Reply #1 on: February 16, 2019, 01:05:24 pm »
Do you mind telling us in which pit did you fall, just in case it happens to someone else? :)
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

440bx

  • Hero Member
  • *****
  • Posts: 3944
Re: How to compile an existing dll ?
« Reply #2 on: February 16, 2019, 02:17:40 pm »
Do you mind telling us in which pit did you fall, just in case it happens to someone else? :)
No problem.  I was compiling a Delphi 2 program and dll I wrote many years ago.  First thing I did was recompile both with Delphi.  Delphi compiled both without any problems.  This is just to establish that it had just been compiled successfully.

I customarily put a description of the program at the very top (or very close to the top) and there was an unmatched "{" in there.  It didn't bother Delphi but, Lazarus and FPC didn't like it at all.

My guess is that Delphi ignores "superfluous" braces while, obviously, Lazarus and FPC do not. 

The problem was a bit disconcerting because I had just successfully compiled both.  The fact that Lazarus would see the entire file as a comment (it did not give any error or warning about an unmatched brace) made me have another look and attempt to find out why.  That's when I noticed there was an unmatched brace inside the description at the top.  Removing it solved the problem.  That brace had been there for over ten years before causing a problem.  Amazing.



(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Thaddy

  • Hero Member
  • *****
  • Posts: 14197
  • Probably until I exterminate Putin.
Re: How to compile an existing dll ?
« Reply #3 on: February 16, 2019, 02:52:38 pm »
freepascal will also ignore superfluous braces in both delphi modes. But in mode objfpc {$modeswitch nestedcomments} is active.... <sigh>
Specialize a type, not a var.

 

TinyPortal © 2005-2018