Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Convert static lib to import lib/DLL

Convert static lib to import lib/DLL

Scheduled Pinned Locked Moved C / C++ / MFC
csharpvisual-studiotutorialquestion
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MR MAB
    wrote on last edited by
    #1

    I have a static lib that we no longer can find the source code for. We want to continue to use the library, but have problems with it in the context of Visual Studio 2005. It uses I/O routines that are no longer supported. I would like to build a mini DLL around this library exposing the functions from the library that we use, but I'm not sure how to do this. I have a static library and an include file that contains export statements for the library. I thought about using dumpbin to get the symbols out of the library, but there are a lot of symbols and I'm not sure what out of the symbols I'm suppose to pull for a .def file. Any one have ideas?

    Mike

    C D 2 Replies Last reply
    0
    • M MR MAB

      I have a static lib that we no longer can find the source code for. We want to continue to use the library, but have problems with it in the context of Visual Studio 2005. It uses I/O routines that are no longer supported. I would like to build a mini DLL around this library exposing the functions from the library that we use, but I'm not sure how to do this. I have a static library and an include file that contains export statements for the library. I thought about using dumpbin to get the symbols out of the library, but there are a lot of symbols and I'm not sure what out of the symbols I'm suppose to pull for a .def file. Any one have ideas?

      Mike

      C Offline
      C Offline
      Chris Losinger
      wrote on last edited by
      #2

      wrote:

      I have a static library and an include file that contains export statements for the library. I thought about using dumpbin to get the symbols out of the library, but there are a lot of symbols and I'm not sure what out of the symbols I'm suppose to pull for a .def file.

      you only need the names (and declarations) of the functions and variables you're going to actually use.... right ?

      image processing toolkits | batch image processing | blogging

      M 1 Reply Last reply
      0
      • M MR MAB

        I have a static lib that we no longer can find the source code for. We want to continue to use the library, but have problems with it in the context of Visual Studio 2005. It uses I/O routines that are no longer supported. I would like to build a mini DLL around this library exposing the functions from the library that we use, but I'm not sure how to do this. I have a static library and an include file that contains export statements for the library. I thought about using dumpbin to get the symbols out of the library, but there are a lot of symbols and I'm not sure what out of the symbols I'm suppose to pull for a .def file. Any one have ideas?

        Mike

        D Offline
        D Offline
        David Leyva
        wrote on last edited by
        #3

        Hi I know that there are some products that convert DLL to lib, but in your case I think you rigth with your idea. The steps could be the following: 1. Build a new dll project in vs2005. 2. In your stdafx.cpp add #pragma comment(lib,"mylib.lib") 3. Include your .lib header file in the project. 4. Declare the new functions, maybe with new names. I expect this steps help you Regards David Leyva

        1 Reply Last reply
        0
        • C Chris Losinger

          wrote:

          I have a static library and an include file that contains export statements for the library. I thought about using dumpbin to get the symbols out of the library, but there are a lot of symbols and I'm not sure what out of the symbols I'm suppose to pull for a .def file.

          you only need the names (and declarations) of the functions and variables you're going to actually use.... right ?

          image processing toolkits | batch image processing | blogging

          M Offline
          M Offline
          MR MAB
          wrote on last edited by
          #4

          Correct. The static library is already in use and could be used as is in Visual Studio 6.0. However, with changes made in Visual Studio 2003 and above to remove the _io routines, I can no longer link the static libary directly into VS2005. To solve this I assume that I can create a wrapper DLL/import lib on top of the static lib using Visual Studio 6.0, but I'm not sure I understand what I need to do to accomplish this. I only wish to expose the functions that I use. There are about 40 of them.

          Mike

          C 1 Reply Last reply
          0
          • M MR MAB

            Correct. The static library is already in use and could be used as is in Visual Studio 6.0. However, with changes made in Visual Studio 2003 and above to remove the _io routines, I can no longer link the static libary directly into VS2005. To solve this I assume that I can create a wrapper DLL/import lib on top of the static lib using Visual Studio 6.0, but I'm not sure I understand what I need to do to accomplish this. I only wish to expose the functions that I use. There are about 40 of them.

            Mike

            C Offline
            C Offline
            Chris Losinger
            wrote on last edited by
            #5

            here's how i usually do it: first, create a "DLL that exports some symbols" project in VC6. for each function you want to export from the DLL, write a function that goes like this:

            Whatever_API_return_Type MyDLLFunction1(params)
            {
            return MyLibFunction1(params);
            }
            Whatever_API return_Type MyDLLFunction2(params)
            {
            return MyLibFunction2(params);
            }
            etc.

            then write headers for those functions:

            _Whatever_API return_Type MyDLLFunction1(params);
            _Whatever_API return_Type MyDLLFunction2(params);
            ...
            _Whatever_API return_Type MyDLLFunction40(params);

            build the DLL, being sure to set the proper #define flag to turn on function exporting (see the main header file for your DLL project). then replace all your MyLibFunction* calls with the corresponding MyDLLFunction* call. link to the DLL's static lib, and that's that...

            image processing toolkits | batch image processing | blogging

            M 1 Reply Last reply
            0
            • C Chris Losinger

              here's how i usually do it: first, create a "DLL that exports some symbols" project in VC6. for each function you want to export from the DLL, write a function that goes like this:

              Whatever_API_return_Type MyDLLFunction1(params)
              {
              return MyLibFunction1(params);
              }
              Whatever_API return_Type MyDLLFunction2(params)
              {
              return MyLibFunction2(params);
              }
              etc.

              then write headers for those functions:

              _Whatever_API return_Type MyDLLFunction1(params);
              _Whatever_API return_Type MyDLLFunction2(params);
              ...
              _Whatever_API return_Type MyDLLFunction40(params);

              build the DLL, being sure to set the proper #define flag to turn on function exporting (see the main header file for your DLL project). then replace all your MyLibFunction* calls with the corresponding MyDLLFunction* call. link to the DLL's static lib, and that's that...

              image processing toolkits | batch image processing | blogging

              M Offline
              M Offline
              MR MAB
              wrote on last edited by
              #6

              I was trying to avoid this, because I wanted to preserve the function names. However, this seems like a reasonable workflow, I will just cross my fingers that these functions are not used all over the place. Thanks for your help.

              Mike

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups