Another Prog
Another Prog

Reputation: 849

In Delphi compiling a library produces an exe extension, is this correct?

I have Delphi Seattle and when I change the "program" keyword in the project source file to "library", and compile/run, it produces an exe. Is this normal? In older copies of delphi it would automatically produce a DLL instead of an exe extension.

Is the solution to change some compiler option or project option setting? There is an output file extension setting, but I thought the compiler would take care of this automatically as soon as you change "program" to "library". In old Delphi 5 it worked.

This may affect other versions than just Seattle, have not tried...

Is this a bug?

Upvotes: 0

Views: 1521

Answers (2)

Rudy Velthuis
Rudy Velthuis

Reputation: 28806

If you start a project as DLL, then the library template is used (the one with the long warning comment), and you automatically get the extension .dll.

If you, however, start a project as a normal program (e.g. a console program), the extension is .exe, and that doesn't automatically change if you change the keyword program to library. I don't think it did that in any earlier Delphi either.

So, to get a default .dll extension, use

File → New → Other... → Delphi Projects → Dynamic-link Library

As already said, you can change the extension in the project options too:

Project → Options... → Application → Output Settings → Target file extension

Or simply as {$E DLL} in the .dpr source code.

Upvotes: 0

Stijn Sanders
Stijn Sanders

Reputation: 36850

The executable extension is a project setting passed to the compiler, but if you want to control it from source, there's the $E compiler directive

Upvotes: 0

Related Questions