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. static link libraries

static link libraries

Scheduled Pinned Locked Moved C / C++ / MFC
questionsales
5 Posts 2 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.
  • A Offline
    A Offline
    ackabacka
    wrote on last edited by
    #1

    Hi, I have a dll project but I no longer want to send the dll to the customer. Instead I want to send a lib file that the customer can link to in their projects (instead of loading the dll as they do today). 1. is there a way to convert the dll project into a static library? if so how? 2. If not, I presume I have to create a new static library project from scratch using New Project w32 static lib. Right? 3. If I have to create a new static lib proj, how do I "export" the functions from the projects so they are available for the customer that will link the lib? Thanks!!!

    M 1 Reply Last reply
    0
    • A ackabacka

      Hi, I have a dll project but I no longer want to send the dll to the customer. Instead I want to send a lib file that the customer can link to in their projects (instead of loading the dll as they do today). 1. is there a way to convert the dll project into a static library? if so how? 2. If not, I presume I have to create a new static library project from scratch using New Project w32 static lib. Right? 3. If I have to create a new static lib proj, how do I "export" the functions from the projects so they are available for the customer that will link the lib? Thanks!!!

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      ackabacka wrote: 3. If I have to create a new static lib proj, how do I "export" the functions from the projects so they are available for the customer that will link the lib? You don't have to do anything. The LIB is essentially like an OBJ file when it comes to linking, the LIB has the compiled version of your code, and the linker will search it for functions that your client calls. -- I'm Michael Dunn and I approve this post. Vote Trogdor in oh-four!

      A 1 Reply Last reply
      0
      • M Michael Dunn

        ackabacka wrote: 3. If I have to create a new static lib proj, how do I "export" the functions from the projects so they are available for the customer that will link the lib? You don't have to do anything. The LIB is essentially like an OBJ file when it comes to linking, the LIB has the compiled version of your code, and the linker will search it for functions that your client calls. -- I'm Michael Dunn and I approve this post. Vote Trogdor in oh-four!

        A Offline
        A Offline
        ackabacka
        wrote on last edited by
        #3

        Michael Dunn wrote: You don't have to do anything. The LIB is essentially like an OBJ file when it comes to linking, the LIB has the compiled version of your code, and the linker will search it for functions that your client calls. OK thanks. I've now created a new static library project and (re) created all functions, as it didn't seem possible to change any setting for the dll project to have it compile a static library (or is it?). It works fine for me, but now I wonder, who can use this library? It doesn't use MFC. Sure, it will only run on intel compatible computers running Windows but what else is required. Of course another VC++ 6 developer could use it (as it's compiled under VC++ v6), but what if the developer is using VC++ .NET environment, with or without managed C++? What if the developer is using another c++ compiler (Intel, Borland etc)? Anyone?

        M 1 Reply Last reply
        0
        • A ackabacka

          Michael Dunn wrote: You don't have to do anything. The LIB is essentially like an OBJ file when it comes to linking, the LIB has the compiled version of your code, and the linker will search it for functions that your client calls. OK thanks. I've now created a new static library project and (re) created all functions, as it didn't seem possible to change any setting for the dll project to have it compile a static library (or is it?). It works fine for me, but now I wonder, who can use this library? It doesn't use MFC. Sure, it will only run on intel compatible computers running Windows but what else is required. Of course another VC++ 6 developer could use it (as it's compiled under VC++ v6), but what if the developer is using VC++ .NET environment, with or without managed C++? What if the developer is using another c++ compiler (Intel, Borland etc)? Anyone?

          M Offline
          M Offline
          Michael Dunn
          wrote on last edited by
          #4

          When you compile the code as C++, the LIB can only be used by compilers that understand the VC name decoration scheme. VC 6 and 7.x do so, as does the Intel compiler. There may be others as well, but those are the only ones I've used. -- I'm Michael Dunn and I approve this post. Vote Trogdor in oh-four!

          A 1 Reply Last reply
          0
          • M Michael Dunn

            When you compile the code as C++, the LIB can only be used by compilers that understand the VC name decoration scheme. VC 6 and 7.x do so, as does the Intel compiler. There may be others as well, but those are the only ones I've used. -- I'm Michael Dunn and I approve this post. Vote Trogdor in oh-four!

            A Offline
            A Offline
            ackabacka
            wrote on last edited by
            #5

            OK, thanks. Actually no classes are availble from "outside". The Lib has a static class (not a class with static functions but a static implemented class), and only plain functions (that calls member functions of the static class) are available from outside (which prototypes are declared in the .h file that I send to the customer). Does this make it possible to use it from even more compilers? If not, is there perhaps a way to mark these functions as "C" functions? Thanks!

            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