Hello everyone!
I'm trying to create a library of " HC595.h " in MinkroC , but I lost starting item 4. "Add __Lib_Example file in some project ." I create a project with the .h and compile it ? Anyone ever used this feature?
Grateful for the attention!!!
Creating New Library
mikroC PRO for PIC allows you to create your own libraries. In order to create a library in mikroC PRO for PIC follow the steps bellow:
Create a new source file, see Managing Source Files
Save the file in one of the subfolders of the compiler's Uses folder:
DriveName:\Program Files\Mikroelektronika\mikroC PRO for PIC\Uses\P16\
DriveName:\Program Files\Mikroelektronika\mikroC PRO for PIC\Uses\P18\
If you are creating library for PIC16 MCU family the file should be saved in P16 folder.
If you are creating library for PIC18 MCU family the file should be saved in P18 folder.
If you are creating library for PIC16 and PIC18 MCU families the file should be saved in both folders.
Write a code for your library and save it.
Add __Lib_Example file in some project, see Project Manager. Recompile the project.
If you wish to use this library for all MCUs, then you should go to Tools › Options › Output settings, and check Build all files as library box.
This will build libraries in a common form which will work with all MCUs. If this box is not checked, then library will be built for selected MCU.
Bear in mind that compiler will report an error if a library built for specific MCU is used for another one.
Compiled file __Lib_Example.mcl should appear in ...\mikroC PRO for PIC\Uses\ folder.
Open the definition file for the MCU that you want to use. This file is placed in the compiler's Defs folder:
DriveName:\Program Files\Mikroelektronika\mikroC PRO for PIC\Defs\
and it is named MCU_NAME.mlk, for example 16F887.mlk
Add the the following segment of code to <LIBRARIES> node of the definition file (definition file is in XML format):
<LIB>
<ALIAS>Example_Library</ALIAS>
<FILE>__Lib_Example</FILE>
<TYPE>REGULAR</TYPE>
</LIB>
Add Library to mlk file for each MCU that you want to use with your library.
Click Refresh button in Library Manager
Example_Library should appear in the Library manager window.
Creating New Library in MikroC
-
- Posts: 28
- Joined: 19 Feb 2015 14:31
Re: Creating New Library in MikroC
Hello everyone!!
Finally I managed to create a library. However I want to catch the methods so that when the User click "Find Declaration", he can not see and do not change the source code.
Any suggestions for that?
Finally I managed to create a library. However I want to catch the methods so that when the User click "Find Declaration", he can not see and do not change the source code.
Any suggestions for that?
- Aleksandar.Mitrovic
- mikroElektronika team
- Posts: 1697
- Joined: 11 Mar 2015 12:48
Re: Creating New Library in MikroC
Hi,
You should add library to the project and compile it in the release mode.
After that you will have generated .mcl file which will represent the source file of your library.
You can then share your .mcl with others.
They will be able to use that functions, but not be able to see them and change them.
Kind regards,
Aleksandar
You should add library to the project and compile it in the release mode.
After that you will have generated .mcl file which will represent the source file of your library.
You can then share your .mcl with others.
They will be able to use that functions, but not be able to see them and change them.
Kind regards,
Aleksandar
-
- Posts: 28
- Joined: 19 Feb 2015 14:31
Re: Creating New Library in MikroC
Got it. And where do I change the project the "Release" mode.
Currently the library is with this configuration Thanks for the help !
Currently the library is with this configuration Thanks for the help !
- Attachments
-
- Sem título.jpg (226.91 KiB) Viewed 5427 times
- Aleksandar.Mitrovic
- mikroElektronika team
- Posts: 1697
- Joined: 11 Mar 2015 12:48
Re: Creating New Library in MikroC
Hi,
Yes like that.
If you want to give user's permission to use your library in the debug mode, then you compile the library in debug mode.
And same like the last one you share the .mcl file not the source.
Like the libraries that we have in our compilers.
Best regards,
Aleksandar
Yes like that.
If you want to give user's permission to use your library in the debug mode, then you compile the library in debug mode.
And same like the last one you share the .mcl file not the source.
Like the libraries that we have in our compilers.
Best regards,
Aleksandar
-
- Posts: 28
- Joined: 19 Feb 2015 14:31
Re: Creating New Library in MikroC
Thank you for your help. Finally I got . Removed the " .c " inside the folder " C : \ Program Files (x86 ) \ Mikroelektronika \ mikroC PRO for PIC \ Uses \ ... " and left only " .mcl " .