Recent

Author Topic: Noob Question about Librarys  (Read 15325 times)

captian jaster

  • Guest
Noob Question about Librarys
« on: November 30, 2010, 05:39:29 am »
I always wondered what's the difference between making a separate unit and building a DLL?
Except for the extra file, why do developers do this?
« Last Edit: November 30, 2010, 05:41:56 am by captain jaster »

Leledumbo

  • Hero Member
  • *****
  • Posts: 8835
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Noob Question about Librarys
« Reply #1 on: November 30, 2010, 07:17:17 am »
Quote
I always wondered what's the difference between making a separate unit and building a DLL?
Units are Pascal specific way to create modular programs, while DLL is language independent, but they have quite a lot of restrictions that you have to be aware of. The advantage of DLL is that the application is modular at executable level, meaning that when you need to update just some parts of your applications (to your customer for instance) they just need to download several small files, while in the case of units (which is integrated in the executable), they have to re-download the whole file.
Quote
Except for the extra file, why do developers do this?
As stated, it's to create modular programs. Modular programs allow people to work in team concurrently (except when a module depends on another), it also makes compilation faster since the compiler will only compile changed or newly added modules, it saves a lot of typing since you don't code the same thing again and again.

captian jaster

  • Guest
Re: Noob Question about Librarys
« Reply #2 on: November 30, 2010, 05:55:29 pm »
Quote
I always wondered what's the difference between making a separate unit and building a DLL?
Units are Pascal specific way to create modular programs, while DLL is language independent, but they have quite a lot of restrictions that you have to be aware of. The advantage of DLL is that the application is modular at executable level, meaning that when you need to update just some parts of your applications (to your customer for instance) they just need to download several small files, while in the case of units (which is integrated in the executable), they have to re-download the whole file.
Quote
Except for the extra file, why do developers do this?
As stated, it's to create modular programs. Modular programs allow people to work in team concurrently (except when a module depends on another), it also makes compilation faster since the compiler will only compile changed or newly added modules, it saves a lot of typing since you don't code the same thing again and again.
Never looked at it that way..
Another question: Would anything I add into a library be usable for other developers like C?

TurboRascal

  • Hero Member
  • *****
  • Posts: 672
  • "Good sysadmin. Bad programmer."™
Re: Noob Question about Librarys
« Reply #3 on: November 30, 2010, 10:28:09 pm »
Units are Pascal specific way to create modular programs

Hmm... I believe that's actually the modula-specific way which Borland adopted for use with Pascal...

Another question: Would anything I add into a library be usable for other developers like C?

Yes, it could be. You should export routines so they could use it, say as cdecl...
Regards, ArNy the Turbo Rascal
-
"The secret is to give them what they need, not what they want." - Scotty, STTNG:Relics

Leledumbo

  • Hero Member
  • *****
  • Posts: 8835
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Noob Question about Librarys
« Reply #4 on: December 01, 2010, 03:28:06 am »
Quote
Hmm... I believe that's actually the modula-specific way which Borland adopted for use with Pascal...
Really? Well... that explains why the format is the same, only differs in keywords (MODULE -> unit, DEFINITION -> interface, etc.)
Quote
Would anything I add into a library be usable for other developers like C?
Yes, if you intend to do that. Just be aware about how C compiler looks for symbols (read the docs about name mangling and interfacing to C) and what (or how) parameters could be passed between them.

captian jaster

  • Guest
Re: Noob Question about Librarys
« Reply #5 on: December 01, 2010, 07:38:39 pm »
Quote
Hmm... I believe that's actually the modula-specific way which Borland adopted for use with Pascal...
Really? Well... that explains why the format is the same, only differs in keywords (MODULE -> unit, DEFINITION -> interface, etc.)
Quote
Would anything I add into a library be usable for other developers like C?
Yes, if you intend to do that. Just be aware about how C compiler looks for symbols (read the docs about name mangling and interfacing to C) and what (or how) parameters could be passed between them.
Thanks guys..
Also Oberon 2 and Modula 2(And Zonnon) all use the Module keyword..
Modula came out after Pascal I believe..

TurboRascal

  • Hero Member
  • *****
  • Posts: 672
  • "Good sysadmin. Bad programmer."™
Re: Noob Question about Librarys
« Reply #6 on: December 01, 2010, 10:12:34 pm »
Yes, and Borland played with Modula2 for a while, but they decided to abandon work on the compiler. Afterwards they "borrowed" modules concept from it to improve their Pascal products...
Regards, ArNy the Turbo Rascal
-
"The secret is to give them what they need, not what they want." - Scotty, STTNG:Relics

captian jaster

  • Guest
Re: Noob Question about Librarys
« Reply #7 on: December 02, 2010, 01:41:29 am »
Yes, and Borland played with Modula2 for a while, but they decided to abandon work on the compiler. Afterwards they "borrowed" modules concept from it to improve their Pascal products...
Didn't pascal always have Units?
The only real one up Modula had on pascal was modularity..
And though Nick did jump ship on the Modula project it was continued in Modula 2 and Oberon(2).(Nonetheless)

Leledumbo

  • Hero Member
  • *****
  • Posts: 8835
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Noob Question about Librarys
« Reply #8 on: December 02, 2010, 08:19:08 am »
Quote
Didn't pascal always have Units?
Nope, check ISO 7185. Original Pascal was damn far from Modern Pascal.

captian jaster

  • Guest
Re: Noob Question about Librarys
« Reply #9 on: December 03, 2010, 06:42:46 pm »
Quote
Didn't pascal always have Units?
Nope, check ISO 7185. Original Pascal was damn far from Modern Pascal.
Damn far?
Wow...

mas steindorff

  • Hero Member
  • *****
  • Posts: 566
Re: Noob Question about Librarys
« Reply #10 on: December 04, 2010, 03:32:23 am »
Damn far?
Wow...
The ideal of units did not come about until d4.  before that we used "include" to break up the code into different files (what a pain). before that that, you just used a cavus or burlap bag to carry your project around :)
windows 10 &11, Ubuntu 21+ IDE 3.4 general releases

Leledumbo

  • Hero Member
  • *****
  • Posts: 8835
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Noob Question about Librarys
« Reply #11 on: December 04, 2010, 03:36:13 am »
Quote
Damn far?
Wow...
Yeah, it's the truly Pascal as educational language:
  • No units
  • No pointer aritmetic
  • No object orientation
  • No typecasts (well, this one is actually good, but we don't have conversion functions between all base types)
  • No untyped pointer
  • Overstrict type checking
  • Statically sized strings (which assignment incompatible with other strings of different size!)
  • Statically sized arrays
  • etc.
Quote
The ideal of units did not come about until d4
d4 = Delphi 4? AFAIK TP (or even UCSD) already had it long before that
« Last Edit: December 04, 2010, 03:38:43 am by Leledumbo »

mas steindorff

  • Hero Member
  • *****
  • Posts: 566
Re: Noob Question about Librarys
« Reply #12 on: December 04, 2010, 03:45:21 am »
d4 = Delphi 4? AFAIK TP (or even UCSD) already had it long before that
I think your right, it was TP4 or 5.  what was the frist delphi rev called?
windows 10 &11, Ubuntu 21+ IDE 3.4 general releases

Leledumbo

  • Hero Member
  • *****
  • Posts: 8835
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Noob Question about Librarys
« Reply #13 on: December 04, 2010, 03:58:24 am »

captian jaster

  • Guest
Re: Noob Question about Librarys
« Reply #14 on: December 06, 2010, 07:57:43 pm »
Thank you for all the answer's
But when should I use stdcall?

 

TinyPortal © 2005-2018