Using static?dynamic library for Linux


#1

Hi.

I am working with a XEM3010 board, and have had some great results using the FrontPanel API on a Windows machine. I now have to move my project to Linux though, and as it happens I am a total Linux newbie.

Initially I am trying to just write a small program in C, which can configure the FPGA, and then work onwards from there.

I have quite a few problems though: The documentation done for the Linux part of the API is in my eyes non-existing. I have been unable to find any documentation on how to use the libraries (static or dynamic), or the syntax of the function calls. Are they the same as the DLL for windows?

What I would like was a quick walkthrough on how to link to the libraries, where to find information on the syntax for the function calls. In short something quite like the documentation that has been done for the Windows platform. Also if someone could give some pros and cons on using either static or dynamic libraries I would appreciate it a lot.

Cheers - Sune.


#2

Sune-

The API is identical for Windows v. Linux. Therefore, the existing API documentation will work on all three platforms.

We presently do not offer a dynamic library for Linux.

Have you been able to build the examples? They include Makefiles that you should be able to replicate. The easiest to follow and use is probably the Makefile for the DESTester.


#3

Hi.

I am not at work right now - live in Europe, so it is weekend for me - sort of anyway… So unfortunately I cannot test the samples right now.

You say you do not provide a dynamic library for Linux. I thought the “shared object” was the Linux equivalent of a windows dll, and you provide the .so right? You also provide the static library .a - which should I use? And why?

I guess the makefiles will show me how the link to the libraries is done? What I find odd is that there is a step-by-step explaination to how to setup projects for windows - which files to include and which libraries to link to. And there is nothing of the sort for Linux - that is what I am missing, as this is all new to me.

Also - I guess I need to have libusb installed on my PC. How is the link to this done? Is it also included in the makefile?

After the weekend I will make some thorough testing on the samples provided, but I hope you can answer some/all of the questions above. Or if anybody else have something to share, I would be glad to hear…

Sune.


#4

Hi Sune-

The .so is, indeed a shared object. Our API for Linux is distributed as a .a file at the moment (static lib). That said, there may be some confusion with the .so files that are part of the Java and Python versions of the API. These are built automatically from our API into Java/Python libs – the distribution method for these libs is a shared object.

Our next release will probably provide dynamic libs for Mac and Linux, as this is generally the preferred method to distribute a library.

The step-by-step method for the Windows stuff is provided because the IDE (Visual Studio) is not very familiar to people and it is sometimes difficult to know where all the files and settings need to go. It’s also a bit harder to just copy a VS project or solution and make it work with your code.

In contrast, Linux is somewhat easier in that the Makefile encapsulates all the settings needed for a build. It’s quite easy to pull the required pieces from a Makefile or just copy it and tweak it for your own application.

We would also provide some more detailed info on building using Mac’s Xcode environment (another IDE), but have not gotten around to that yet.

libusb comes with Fedora Core 5 (the distribution we officially support) as well as most other distributions. Adding a library to build in with GCC is a matter of just adding “-lusb”. (usually)

Our position is to provide samples and some getting started items for our products, but because we support many different platforms, languages, and tools, we cannot possibly write complete tutorials for all (Java, FPGA, Python, C++, Windows, Linux, Xilinx ISE, Mac, ActiveHDL, ModelSim, etc)

Instead, we refer you to the appropriate documentation for the platform and tool you are using to learn more about that tool.


#5

Hi.

Thank you for clearing that out. It now makes more sence with the different libs.

As it happens, I have quite a bit of experience with Visual Studio, but still found your documentation very usefull. So I was just hopeing for something similar for Linux. I will take a look at the makefiles though, and I am sure I can work it all out from that.

Thank you for your replys - it is a very good thing you use these forums for support, as I usually have problems getting support from USA because of the time difference. At least in the working hours…

If further problems occour I will post here again.

Sune.