September 20, 2020, 06:11:58 am

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Creating and using components

Started by Doc, February 09, 2010, 05:03:02 am

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Doc

February 09, 2010, 05:03:02 am Last Edit: February 09, 2010, 05:13:33 am by Doc
Since Creative Basic cannot produce compiled DLL's the same way Emergence does, Paul added the "Components" feature to allow users to produce something similar to a DLL for use in any Creative Basic program. The help file has all of the specifics to creating and using components and the images below will show how to create or use them from the IDE:







Basically the code included in a component is compiled into a special format that works similar to a regular Windows DLL, but that can only be used with Creative Basic. Once you have included a compiled component into your program, all of the subs and routines can be called just as if you wrote the code in your CBA source file.

In addition to making it more convenient to write or share code with other CB users, everything included in the component becomes compiled as part of your standalone executable. Unlike using a DLL, you do not have to include your component with the executable file. :)

One thing to take note of is that you need to keep a separate copy of the source files used to create a component. Once the source has been compiled from the IDE, it can no longer be edited.

See the help file for full details.

-Doc-

aurelCB

Doc your overview is not bad but contain one big mistake.
Components are not similiar with DLL then with SLL which is not the same.
From CB help:
QuoteComponents
Components are precompiled Creative BASIC subroutines than can be included into other projects, this allows reusing code many times without having to cut and paste. Components are written like any other Creative BASIC program with the exception that they cannot contain any global variables or definitions. A component is similar to statically linked libraries in other languages such as 'C'. The subroutines in a component can contain DECLARE statements to predefine API calls.


A component is similar to statically linked libraries

I talk to with Zero and he agree that components are similiar to include files in Ebasic.
forum for hobby programming:<br />https://aurelsoft.ucoz.com

Doc

Well, technically you are correct, but it's more of a matter of personal perception than mistake. In actual usage, there isn't that much difference between the two. (In both cases you make declarations and point to sub routines.)  ;)

QuoteI talk to with Zero and he agree that components are similiar to include files in Ebasic.


Sorry, but that doesn't float. Components are compiled and cannot be edited like include files can be. In actual usage, there isn't that much difference between the two, so again, it's just a matter of personal perspective.

The whole point is that components make it very easy to re-use (or share) code, without the hassles of continually copying & pasting code from one project to another or without having to distribute a separate DLL along with your exe file. It also helps protect the source code from prying eyes, should that be important to you. (In the case you wanted to sell your work as an add on library)

No use splitting hairs over terminology.  ::)

-Doc-

aurelCB

No problem Doc i understand ,just observation.. ;)
forum for hobby programming:<br />https://aurelsoft.ucoz.com