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 linking

Static linking

Scheduled Pinned Locked Moved C / C++ / MFC
csharpc++
6 Posts 4 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
    Member 11201788
    wrote on last edited by
    #1

    Our application develped in C# uses a dll and static library(lib). The dll is intermediate project for static libraty and C# application. Client has provided files(library file and a dll) which is required for interacting with their application. 1. In our C++ static library we are using only the library file provided by client by statically linking it. 2. Our C++ wrapper dll references this C++ static library created in step 1. 3. C# application references the wrapper dll created in step 2. Since the library file is statically linked in our C++ static library, does the dll also need to be linked/referred in our application.

    G L A 3 Replies Last reply
    0
    • M Member 11201788

      Our application develped in C# uses a dll and static library(lib). The dll is intermediate project for static libraty and C# application. Client has provided files(library file and a dll) which is required for interacting with their application. 1. In our C++ static library we are using only the library file provided by client by statically linking it. 2. Our C++ wrapper dll references this C++ static library created in step 1. 3. C# application references the wrapper dll created in step 2. Since the library file is statically linked in our C++ static library, does the dll also need to be linked/referred in our application.

      G Offline
      G Offline
      Garth J Lancaster
      wrote on last edited by
      #2

      its not clear how the c# application (3) is using the c++ wrapper (2) if you're using p/invoke, then the 'reference/link' is in the p/invoke statements themselves, ie, the DllImport clause

      1 Reply Last reply
      0
      • M Member 11201788

        Our application develped in C# uses a dll and static library(lib). The dll is intermediate project for static libraty and C# application. Client has provided files(library file and a dll) which is required for interacting with their application. 1. In our C++ static library we are using only the library file provided by client by statically linking it. 2. Our C++ wrapper dll references this C++ static library created in step 1. 3. C# application references the wrapper dll created in step 2. Since the library file is statically linked in our C++ static library, does the dll also need to be linked/referred in our application.

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        If the C++ dll has been linked to the static library, then you only need access to that dll in your C# code (assuming I have understood the question correctly).

        1 Reply Last reply
        0
        • M Member 11201788

          Our application develped in C# uses a dll and static library(lib). The dll is intermediate project for static libraty and C# application. Client has provided files(library file and a dll) which is required for interacting with their application. 1. In our C++ static library we are using only the library file provided by client by statically linking it. 2. Our C++ wrapper dll references this C++ static library created in step 1. 3. C# application references the wrapper dll created in step 2. Since the library file is statically linked in our C++ static library, does the dll also need to be linked/referred in our application.

          A Offline
          A Offline
          Albert Holguin
          wrote on last edited by
          #4

          Member 11201788 wrote:

          Since the library file is statically linked in our C++ static library, does the dll also need to be linked/referred in our application.

          Do you mean dll or lib at this point? If you mean lib, then it should be a no, you don't need a reference to it while building your C# application. If you mean dll, then yes, your C# application does need a reference to your dll.

          M 1 Reply Last reply
          0
          • A Albert Holguin

            Member 11201788 wrote:

            Since the library file is statically linked in our C++ static library, does the dll also need to be linked/referred in our application.

            Do you mean dll or lib at this point? If you mean lib, then it should be a no, you don't need a reference to it while building your C# application. If you mean dll, then yes, your C# application does need a reference to your dll.

            M Offline
            M Offline
            Member 11201788
            wrote on last edited by
            #5

            Since the library file(lib provided by client) is statically linked in our C++ static library, does the dll(lib provided by client) also need to be linked/referred in our application. They(client) have provided their .lib and .dll. Can we use only .lib in our C++ static library.

            A 1 Reply Last reply
            0
            • M Member 11201788

              Since the library file(lib provided by client) is statically linked in our C++ static library, does the dll(lib provided by client) also need to be linked/referred in our application. They(client) have provided their .lib and .dll. Can we use only .lib in our C++ static library.

              A Offline
              A Offline
              Albert Holguin
              wrote on last edited by
              #6

              Member 11201788 wrote:

              Since the library file(lib provided by client) is statically linked in our C++ static library, does the dll(lib provided by client) also need to be linked/referred in our application.

              Shouldn't have to... if you load the lib into your dll properly.

              Member 11201788 wrote:

              They(client) have provided their .lib and .dll. Can we use only .lib in our C++ static library.

              Again, should be able to just use the lib, since it's a collection of objects. Only thing that may be a limiter is that you have to use a lib that was compiled with the same compilation settings as your project, since the name mangling of C++ can affect you being able to find your methods. A lot of people tend to do their exports/imports in a C-style format even within C++ in order to avoid C++ name mangling issues.

              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