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. Help with importing .dll

Help with importing .dll

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++helptutorial
6 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.
  • K Offline
    K Offline
    kialmur
    wrote on last edited by
    #1

    I am a bit new at C++. I am trying to important various functions from a .dll file. I have both the .dll and the .lib files, and I know the function definition because they were previously imported in a Visual Basic project. How can I use the functions? For example, say I have the files x.dll and x.lib, which contain a function int z(int). What do I need to do use that function? The only method I found was using the __declspec(dllimport) int z(int);, and I am not even sure if that is correct since it gave me linking errors. Thanks in advance for your help. Kiernan

    D 1 Reply Last reply
    0
    • K kialmur

      I am a bit new at C++. I am trying to important various functions from a .dll file. I have both the .dll and the .lib files, and I know the function definition because they were previously imported in a Visual Basic project. How can I use the functions? For example, say I have the files x.dll and x.lib, which contain a function int z(int). What do I need to do use that function? The only method I found was using the __declspec(dllimport) int z(int);, and I am not even sure if that is correct since it gave me linking errors. Thanks in advance for your help. Kiernan

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      kialmur wrote:

      ...I am not even sure if that is correct since it gave me linking errors.

      Did you link with x.lib?


      "Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain

      "There is no death, only a change of worlds." - Native American Proverb

      K 1 Reply Last reply
      0
      • D David Crow

        kialmur wrote:

        ...I am not even sure if that is correct since it gave me linking errors.

        Did you link with x.lib?


        "Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain

        "There is no death, only a change of worlds." - Native American Proverb

        K Offline
        K Offline
        kialmur
        wrote on last edited by
        #3

        I am not quite sure how. I tried adding it to the project and also added it in one of project settings under Linking. Is there some otherway?

        D 1 Reply Last reply
        0
        • K kialmur

          I am not quite sure how. I tried adding it to the project and also added it in one of project settings under Linking. Is there some otherway?

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          kialmur wrote:

          Is there some otherway?

          There is, but if you are already adding it to the linker options, it's pointless. Exactly what linker error(s) are you getting?


          "Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain

          "There is no death, only a change of worlds." - Native American Proverb

          K 1 Reply Last reply
          0
          • D David Crow

            kialmur wrote:

            Is there some otherway?

            There is, but if you are already adding it to the linker options, it's pointless. Exactly what linker error(s) are you getting?


            "Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain

            "There is no death, only a change of worlds." - Native American Proverb

            K Offline
            K Offline
            kialmur
            wrote on last edited by
            #5

            The error is: error LNK2001: unresolved external symbol "long __cdecl sendChipOffset(long,long,long)" (?sendChipOffset@@YAJJJJ@Z) For the linking portion, I went in the project settings, then to the Link tab. I added the path under Object/library modules. Is that correct?

            D 1 Reply Last reply
            0
            • K kialmur

              The error is: error LNK2001: unresolved external symbol "long __cdecl sendChipOffset(long,long,long)" (?sendChipOffset@@YAJJJJ@Z) For the linking portion, I went in the project settings, then to the Link tab. I added the path under Object/library modules. Is that correct?

              D Offline
              D Offline
              David Crow
              wrote on last edited by
              #6

              kialmur wrote:

              The error is: error LNK2001: unresolved external symbol "long __cdecl sendChipOffset(long,long,long)" (?sendChipOffset@@YAJJJJ@Z)

              This is a name-mangling issue.

              kialmur wrote:

              Is that correct?

              Yes.


              "Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain

              "There is no death, only a change of worlds." - Native American Proverb

              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