2

I'm trying to solve linear systems of equations with pardiso. I have downloaded everything I might need from the website ( three files: .lib, .dll and .exp files).

I know what's dll and lib, and know nothing about .exp. Moreover, I search the internet and find out I need a header file. But pardiso doesn't provide me .h file.

What's more, pardiso provides some examples among which I want to use http://www.pardiso-project.org/manual/pardiso_unsym.cpp.

Now comes my problem. How do I use .lib/.dll/.exp files in VC++ 2015 without header file? I know there are two ways to load .dll file: dynamically and statically, but have no idea how to implement.

Maybe my problem is quite easy because I don't know much about C/C++ and dll. So please kindly help me.

Thank you so much!

Community
  • 1
  • 1
Alston
  • 33
  • 5
  • Just look at the website's sample code. For some very bizarre reason you have to declare the function prototypes in your own source file yourself. Always good when you can tell in less 5 minutes that a library is junk and not worth your time. – Hans Passant Jun 10 '16 at 13:00
  • So you're saying that the pardiso is junk? Which solver can I use, then? – Alston Jun 11 '16 at 07:38

2 Answers2

3

I didn't download the package myself, but I will take your word that there are no header files in it (seems such from the example you linked to).

First off, not including header files is an extremely weird way of distributing a library.

Looking through the Pardiso manual, it seems they're actually publishing the function interfaces in there. So how you would use it is create the header file yourself by recreating the function prototypes based on information from that PDF. See for example page 7 of the manual, which lists two function calls:

/* Check license of the solver and initialize the solver */
pardisoinit(pt, &mtype, &solver, iparm, dparm, &error);

/* Solve matrix sytem */
pardiso(pt, &maxfct, &mnum, &mtype, &phase, &n, a, ia, ja,
        perm, &nrhs, iparm, &msglvl, b,  x, &error, dparm);

In the previous and following sections of that PDF, the Fortran prototypes for these functions are given, and their arguments are described in text. From this information, you would have to reconstruct the prototype.

An alternative source for these prototypes would be the examples provided by Pardiso, which apparently contain the prototypes directly. It is up to you to verify whether copy-pasting them would be OK license-wise.

Why they're doing it this way is beyond me, but it seems they are.

To answer the .exp file question: it's basically similar to the .lib file in that it specifies which symbols are exported from a .dll. It can safely be ignored in normal situations. You would need to use one only if you had two binaries (DLL or exe) which link against each other in a circular fashion.

Angew is no longer proud of SO
  • 167,307
  • 17
  • 350
  • 455
  • 1
    From the examples given by **pardiso** there are some function prototypes like `extern "C" void pardisoinit (void *, int *, int *, int *, double *, int *); `. Should I extract them into a new .h file ? – Alston Jun 10 '16 at 11:36
  • @Alston True. You could just copy-paste those into the hader you create, then. Expanded the answer. – Angew is no longer proud of SO Jun 10 '16 at 11:36
  • Thank you so much. let me do it now. :). – Alston Jun 10 '16 at 11:43
  • Hi Angew, your method works well. And I find out that even without the header file the example works. The cause is I forgot to add the library directionary in VC. Thank you for your answer! – Alston Jun 11 '16 at 01:56
  • Hi Angew, I've got a new problem here. I need a license using Pardiso ( a pardiso.lic file ) and I don't where to place the file. As in the manual, `This license file can be in the home directory of the user, or in the directory from which the user runs a program linked with the PARDISO library. Alternatively, this file can be placed in a fixed location and the environment variable PARDISO LIC PATH set to the path of its location. ` Should I just put the .lic file under the root directory of my VC project? – Alston Jun 11 '16 at 04:30
  • @Alston They list three locations in there. Use one. I'd go with the fixed location and `PARDISO_LIC_PATH` myself. – Angew is no longer proud of SO Jun 13 '16 at 22:04
  • Thank you so much. I have succeeded! – Alston Jun 14 '16 at 06:12
0

Just link the .lib to your VS project and copy .dll to your .exe location(or project location if you can debugging with Visual Studio) and you can setup the project WITHOUT .h files(only in the certain Pardiso case).