Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

Managed Library Project

Altera_Forum
Honored Contributor II
985 Views

In NiosII IDE, we can create a independent library. Then we can use this library in our c/c++ application project. 

 

I write my code in C++ and I need to provide part of code(interface of some classes) to my customer. But I also need to hide some important code( C++ classes) to customer. So I want to build these classes into a library, and only provide the library file *.a to my customer. 

 

Is it possible to bring only C++ application project and the library file *.a which is created by managed library project to customer without source code of managed library project? 

 

Is there any document to clarify this issue? 

 

 

Thanks for any help, 

David
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
267 Views

I have created a managed library project and use it in my application successfully basing on the following instructions: 

 

Create your managed library project and your C/C++ application project.  

Reference the managed library project from your C/C++ application project: 

a) Right-click your project in the C/C++ Projects view and choose Properties. 

 

http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/cool.gif Select Project References. 

 

c) Select the managed library project you want to reference. 

 

This step ensures that your managed library project builds before your C/C++ application project. It also ensures you can easily step into the managed library code when debugging your application project.  

 

Set up the linker options so your C/C++ application project can locate your library. The C/C++ library of a managed library project is not automatically detected when you reference the project; it has to be explicitly added. 

a) In the Properties dialog box, select C/C++ Build. 

 

http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/cool.gif Select the Tool Settings tab. 

 

c) Select Linker > General. 

 

d) In the Libraries section, click Add Library and type the name of the managed library project. Do not press the Browse... button. 

 

e) In the Library Paths section, click Add Library Path and add the path to the *.a library file. The library path should include the Debug or Release folder. Note that you will have to update the library path if you change the configuration (i.e. Release or Debug) of the managed library project.  

 

Set up the include paths to locate headers from your Managed Library project. If your managed library project includes header files you would like to access from your C/C++ application project, you need to specifically enter the paths to the header files. 

a) On the Tool Settings tab, select Nios II Compiler > General. 

 

http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/cool.gif In the Include Paths section, click Add Include Path and add the full or relative path to the folder containing the header files.  

Click OK to close the Properties dialog box.  

 

The library project created mylib.a for me, and I hope use it directly. 

So I copy it to my application directory(C:/altera/OSD_FINAL/JaidNiosOSD/software/TestCPP), then I edit linker in project property: 

linker->General->Libraries: mylib 

linker->General->Library Paths: C:/altera/OSD_FINAL/JaidNiosOSD/software/TestCPP 

 

But the compiler report that "cannot find -lmylib". 

 

Anybody help, 

David
0 Kudos
Altera_Forum
Honored Contributor II
267 Views

 

--- Quote Start ---  

originally posted by david_cai@Jul 10 2006, 10:23 AM 

i have created a managed library project and use it in my application successfully basing on the following instructions: 

 

create your managed library project and your c/c++ application project.  

reference the managed library project from your c/c++ application project: 

a) right-click your project in the c/c++ projects view and choose properties. 

 

http://forum.niosforum.com/work2/style_emoticons/<#emo_dir#>/cool.gif select project references. 

 

c) select the managed library project you want to reference. 

 

this step ensures that your managed library project builds before your c/c++ application project. it also ensures you can easily step into the managed library code when debugging your application project.  

 

set up the linker options so your c/c++ application project can locate your library. the c/c++ library of a managed library project is not automatically detected when you reference the project; it has to be explicitly added. 

a) in the properties dialog box, select c/c++ build. 

 

http://forum.niosforum.com/work2/style_emoticons/<#emo_dir#>/cool.gif select the tool settings tab. 

 

c) select linker > general. 

 

d) in the libraries section, click  add library and type the name of the managed library project. do not press the browse... button. 

 

e) in the library paths section, click  add library path and add the path to the *.a library file. the library path should include the debug or release folder. note that you will have to update the library path if you change the configuration (i.e. release or debug) of the managed library project.  

 

set up the include paths to locate headers from your managed library project. if your managed library project includes header files you would like to access from your c/c++ application project, you need to specifically enter the paths to the header files. 

a) on the tool settings tab, select nios ii compiler > general. 

 

http://forum.niosforum.com/work2/style_emoticons/<#emo_dir#>/cool.gif in the include paths section, click  add include path and add the full or relative path to the folder containing the header files.  

click ok to close the properties dialog box.  

 

    the library project created mylib.a for me, and i hope use it directly. 

    so i copy it to my application directory(c:/altera/osd_final/jaidniososd/software/testcpp), then i edit linker in project property: 

linker->general->libraries: mylib 

linker->general->library paths: c:/altera/osd_final/jaidniososd/software/testcpp 

 

    but the compiler report that "cannot find -lmylib". 

   

anybody help, 

david 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=16730) 

--- quote end ---  

 

--- Quote End ---  

0 Kudos
Reply