• AVR Freaks

Hot!MPLab precopiled library

Author
stoyanoff
Super Member
  • Total Posts : 226
  • Reward points : 0
  • Joined: 2011/01/10 03:37:28
  • Location: 0
  • Status: offline
2019/10/12 09:04:12 (permalink)
0

MPLab precopiled library

Greetings! I am making my first test with MPLab lib files. So I`ve made a lib project and compiled a .X.a file. So I`ve managed to add it to a new project and everything seems fine. I have a question. When I start the project with this precompiled lib and stop with a debuger somewhere in the code, I can see the lib .c files and the code in them! Is this normal? Is there a way this code to be hidden? So the user to be able to use it as precompiled functions, but to not be able to see or change it?
Thanks!
#1

9 Replies Related Threads

    Gort2015
    Klaatu Barada Nikto
    • Total Posts : 3315
    • Reward points : 0
    • Joined: 2015/04/30 10:49:57
    • Location: 0
    • Status: offline
    Re: MPLab precopiled library 2019/10/12 10:21:38 (permalink)
    +1 (1)
    Someone using your library will not have access to the source, probably because you are debugging that you can.

    MPLab X playing up, bug in your code? Nevermind, Star Trek:Discovery will be with us soon.
    https://www.youtube.com/watch?v=Iu1qa8N2ID0
    + ST:Continues, "What Ships are Made for", Q's back.
    #2
    stoyanoff
    Super Member
    • Total Posts : 226
    • Reward points : 0
    • Joined: 2011/01/10 03:37:28
    • Location: 0
    • Status: offline
    Re: MPLab precopiled library 2019/10/12 12:49:56 (permalink)
    0
    I can`t understand! You are telling me if I give this lib to someone else he won`t be able to see the souce! So if make another project with the same lib I shouldm`t be able too! But this is not true! I`ve tried!
    #3
    jtemples
    عُضْوٌ جَدِيد
    • Total Posts : 11407
    • Reward points : 0
    • Joined: 2004/02/13 12:31:19
    • Location: Southern California
    • Status: offline
    Re: MPLab precopiled library 2019/10/12 13:32:30 (permalink)
    +1 (1)
    Have you stripped the library?
    #4
    NorthGuy
    Super Member
    • Total Posts : 5754
    • Reward points : 0
    • Joined: 2014/02/23 14:23:23
    • Location: Northern Canada
    • Status: offline
    Re: MPLab precopiled library 2019/10/12 13:50:14 (permalink)
    +1 (1)
    How can someone see the source if you don't give it to them? Unless you remove the debugging information from the library, they will be able to see debugging information, symbols, types, location of the source files on your computer, but not the files themselves.
    #5
    Gort2015
    Klaatu Barada Nikto
    • Total Posts : 3315
    • Reward points : 0
    • Joined: 2015/04/30 10:49:57
    • Location: 0
    • Status: offline
    Re: MPLab precopiled library 2019/10/12 14:46:14 (permalink)
    0
    In PP you can see the library source but that source just means that you have that lib. open for editing.
     
    When a library or object files are added to libraries the linker can make use of these but it does not know about your source.
     
    The linker fills in the blanks.
    post edited by Gort2015 - 2019/10/12 14:51:40

    MPLab X playing up, bug in your code? Nevermind, Star Trek:Discovery will be with us soon.
    https://www.youtube.com/watch?v=Iu1qa8N2ID0
    + ST:Continues, "What Ships are Made for", Q's back.
    #6
    stoyanoff
    Super Member
    • Total Posts : 226
    • Reward points : 0
    • Joined: 2011/01/10 03:37:28
    • Location: 0
    • Status: offline
    Re: MPLab precopiled library 2019/10/12 23:38:33 (permalink)
    0
    Ok! I am doing something wrong here. Here is simple example - I am creating a lib project with this in it:
    my_lib.h

     
    int My_SUM(int a,int b);
     

    my_lib.c

    #include "my_lib.h"
    int My_SUM(int a, int b)
     
    {
     
    return a+b;
     
    }
     

    I am compiling this code and I have this file first_lib.X.a in dist/default/production.
    So I copy this file to a new project and the my_lib.h! I include my_lib.h to the new project and add first_lib.X.a to library section. The project is compiling and working properly, but if I put a break point to 

     
    p=My_SUM(5,8);
     

    and press step forward, the program jumps to my_lib.c(I think this is in the lib file) and I can see the code and everything inside!
    What am I doing wrong? 
    #7
    andersm
    Super Member
    • Total Posts : 2666
    • Reward points : 0
    • Joined: 2012/10/07 14:57:44
    • Location: 0
    • Status: offline
    Re: MPLab precopiled library 2019/10/13 03:02:58 (permalink)
    +1 (1)
    Delete the library source code, or copy the library to another machine and try there. The debug info stores the path to the source code inside the object file, but if the source code file is not available then the debugger can't show it.
     
    Open the object files in a hex editor to see exactly what is stored inside them.
    #8
    stoyanoff
    Super Member
    • Total Posts : 226
    • Reward points : 0
    • Joined: 2011/01/10 03:37:28
    • Location: 0
    • Status: offline
    Re: MPLab precopiled library 2019/10/13 23:17:59 (permalink)
    0
    I did it! Thanks!
    #9
    Gort2015
    Klaatu Barada Nikto
    • Total Posts : 3315
    • Reward points : 0
    • Joined: 2015/04/30 10:49:57
    • Location: 0
    • Status: offline
    Re: MPLab precopiled library 2019/10/14 04:26:11 (permalink)
    -1 (1)
    In your .h file, use the external keyword.

    extern int
        My_SUM(int a, int b);
    post edited by Gort2015 - 2019/10/14 04:28:31

    MPLab X playing up, bug in your code? Nevermind, Star Trek:Discovery will be with us soon.
    https://www.youtube.com/watch?v=Iu1qa8N2ID0
    + ST:Continues, "What Ships are Made for", Q's back.
    #10
    Jump to:
    © 2019 APG vNext Commercial Version 4.5