How to convert .Lib to .DLL?

I have a library file(for Djvu file Interaction),which is written in Unmanaged code(MFC).I want to convert it in DLL so that I can use it with C#.Net.

How this can be done OR is there any equvilant way to do that.

Thanks

From

Azeem Sarwar



Answer this question

How to convert .Lib to .DLL?

  • omrivm

    AFAIK, Import Libraries (*.lib) are just information for a dynamic link library to resolve references and for the linker to build the import table of an executable. You should have the actual DLL (*.dll) together with your import library in order for it to work.

    For example: kernel32.lib provides reference information for kernel32.dll.

    Try searching for the actual DLL, then use that DLL for your C# project, but instead of using import library, you need to use p/invoke in C#.


    Hope that helps,

    -chris



  • Fayez Mutairi

    I know this thread's long dead, but I found it while looking for the same solution as the original poster. Unfortunately, I think you've missed the mark a bit, Chris.

    I have a .lib file, originally used in a static-link scenario, and I must switch to a dynamic-link scenario. This means I have to create a DLL which contains (and exports) all the entry points in the original .lib file.

    The hard way appears to be using DUMPBIN to locate all the entry points in the original .lib file, then creating an export definition list to force the linker to construct the DLL from the object files in the .lib. I was kind of hoping that something as brain-dead as this would have already been automated, but I haven't found any references yet.



  • Mat_77

    I think Chris assumed that the DLL was developed by someone else other than Azeem (the person asking the question). My guess is that Azeem either wrote the code or has access to the source and can modify the source.

    I am nearly certain that it is not possible to convert a static-link library to a dynamic-link library without recompiling at least. I have worked with static (traditional) and dynamic (newer) linking since before Microsoft existed. Each operating system has it's own details of implementation but the concepts are the same. All operating sytems I am familiar with create static and dynamic libraries in ways that vary such that they get linked differently; I think that even the source code varies. The source code for a Windows static and dynamic library certainly varies.

    So for you, Wolf Logan, I suggest that you create a new thread to ask any additional questions, since your question is different. For Azeem, I assume that MFC was a problem; if the DLL used MFC in it's interface, then the DLL could only be used by another program developed using MFC.



  • How to convert .Lib to .DLL?