Debmedia Creation Forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.

HOW TO CREATE LIBRARY FILES IN C:

Go down

HOW TO CREATE LIBRARY FILES IN C: Empty HOW TO CREATE LIBRARY FILES IN C:

Post  Admin Wed Oct 08, 2008 4:33 pm

Here I want to share a great knowledge with all. That is, how we can create our own library files and also a project file (.PRG) in C.

We all know that when we want to write any C program, most of the occasion (almost all occasions), we have to include "stdio.h" file in our program. But can you ever see this file? I mean, can you notice, what source codes this file have? Just open this file in either c compiler or in notepad and see. You hardly understand these codes. If you write them in your file and want to run, it won't run. Because, C creates this file by another method. Think, that you also want to create a header file by writing your own codes. But wants that, anybody can include this file in their program, but cannot understand what codes your header file has. Then it would be a very great protection system of your source codes. Nobody can copy or change them. It will be only yours. Isn't great? Here I present the technique by which, you can create your own Library files.

HOW TO CREATE LIBRARY FILES IN C:

When we write any C programs, it runs as a standard EXE file. So, when we want to make a library file, we have to change it to standard exe to library. Here is the steps:-

1) Write a C program with one or more function(s) definitions created by you (without main).

2) Save the file with the extension of "C". Example : Test.c

3) Now select OPTIONS>APPLICATIONS menu.

4) Select "Library" from three Options there. By default, it would be "Standard". Click OK.

5) Now just compile your C programming by pressing Alt+F9, and make it by pressing F9. Remind, not Ctrl+F9. Because it cannot run there as it is not a standard exe project.

6) Now open your working folder, by default it is "C:\tc".

7) Here you can see that you have a newly created file, called "Test.lib" (as I named our C file as Test.c).

It is that library file we want to make.

Now we have our library file. Here I show you, how we can use this file to create a C project file and make our own Exe file for distributions.

HOW TO USE LIBRARY FILES AND MAKE PROJECT IN C:

1) Write a C programs with the header section:

#pragma comment (lib, "test.lib")

(No #include needed to include your header file. Here test.lib should be you newly created library file.)

2) now write your program with main and functions, that you creates in your library file.

3) Just save compile this file as we compile library file by pressing Alt+F9.

4) Now click on PROJECT menu and select OPEN PROJECT. (Remember, when you want to make a new project, it also show you the menu Open project instead of Create project).

5) Give a name to your project with the extension of .prg.

6) Now see the bottom help line of the C compiler. There you can see a shortcut to "Add", and that is Ins. Means Insert button for adding file to your project. Here just add those two files. One is "test.lib" and other is "test.c".

7) Now we all ready to make our exe file from this files. Now just make the file by pressing F9. remember, only F9, not Alt+F9 or Ctrl+F9.

Cool Now see in the working folder that there we get the output executable file.

What are you think about now? Just go and create you own Library file and distribute without any hesitation. Nobody can cheat you. HAHA.
Admin
Admin
Admin

Posts : 256
Join date : 2008-06-06

https://debmedia.forumotion.com

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum