c++visual-c++dllpardiso

How to use .lib, .dll and .exp file in VC++?


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!


Solution

  • 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.