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. Is it possible to link dll statically without .lib

Is it possible to link dll statically without .lib

Scheduled Pinned Locked Moved C / C++ / MFC
delphiquestion
10 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.
  • V Offline
    V Offline
    Valera241176
    wrote on last edited by
    #1

    :omg:I have a dll written with Delphi. Certainly I have no .lib, but I know how exported functions are declared in this dll. Is it possible to make .lib from this dll to link it statically in C-compiled .exe? Or maybe there is some other way?

    A T J 3 Replies Last reply
    0
    • V Valera241176

      :omg:I have a dll written with Delphi. Certainly I have no .lib, but I know how exported functions are declared in this dll. Is it possible to make .lib from this dll to link it statically in C-compiled .exe? Or maybe there is some other way?

      A Offline
      A Offline
      Alvaro Mendez
      wrote on last edited by
      #2

      :omg: Delphi doesn't give you a way to generate a LIB file for its DLL? Anyway, if you know the exact signatures of the functions exported, you can then use LoadLibrary/GetProcAddress to call them. It's not fun, but it's the only way I know to do this. Regards, Alvaro


      The world is a dangerous place, not because of those who do evil, but because of those who look on and do nothing. -- Albert Einstein

      V 1 Reply Last reply
      0
      • A Alvaro Mendez

        :omg: Delphi doesn't give you a way to generate a LIB file for its DLL? Anyway, if you know the exact signatures of the functions exported, you can then use LoadLibrary/GetProcAddress to call them. It's not fun, but it's the only way I know to do this. Regards, Alvaro


        The world is a dangerous place, not because of those who do evil, but because of those who look on and do nothing. -- Albert Einstein

        V Offline
        V Offline
        Valera241176
        wrote on last edited by
        #3

        Yes, this is obvious way. This way we link dll dynamically, right? I also think that it is the only way to link dll without .lib. But maybe some one knows the way to make the .lib for it?

        A 1 Reply Last reply
        0
        • V Valera241176

          Yes, this is obvious way. This way we link dll dynamically, right? I also think that it is the only way to link dll without .lib. But maybe some one knows the way to make the .lib for it?

          A Offline
          A Offline
          Alvaro Mendez
          wrote on last edited by
          #4

          I've seen this question asked here before and no one has come up with a solution. Frankly, I don't think there's a way to do it, but hopefully I'm wrong. :-) Regards, Alvaro


          The world is a dangerous place, not because of those who do evil, but because of those who look on and do nothing. -- Albert Einstein

          V 1 Reply Last reply
          0
          • A Alvaro Mendez

            I've seen this question asked here before and no one has come up with a solution. Frankly, I don't think there's a way to do it, but hopefully I'm wrong. :-) Regards, Alvaro


            The world is a dangerous place, not because of those who do evil, but because of those who look on and do nothing. -- Albert Einstein

            V Offline
            V Offline
            Valera241176
            wrote on last edited by
            #5

            :)Thanks. You have declined me to suggestion that even it is possible, it is probably not worth it!

            1 Reply Last reply
            0
            • V Valera241176

              :omg:I have a dll written with Delphi. Certainly I have no .lib, but I know how exported functions are declared in this dll. Is it possible to make .lib from this dll to link it statically in C-compiled .exe? Or maybe there is some other way?

              T Offline
              T Offline
              Ted Ferenc
              wrote on last edited by
              #6

              Yes, I think it can be done, I did something similar a few years ago, before I delve into my notes, they are not very good, do you have the header '.h' file that gives the function definitions, because without it is very difficult. It is likely to take me a few days to sort it out, and to test it, so let me know, but I won't make any guarantees!


              If I have seen further it is by standing on the shoulders of Giants. - Isaac Newton 1676

              1 Reply Last reply
              0
              • V Valera241176

                :omg:I have a dll written with Delphi. Certainly I have no .lib, but I know how exported functions are declared in this dll. Is it possible to make .lib from this dll to link it statically in C-compiled .exe? Or maybe there is some other way?

                J Offline
                J Offline
                JohnnyG
                wrote on last edited by
                #7

                I'm not sure I understand your question but if you're asking if there is a way to create a .lib file from a dll file, I think I found your answer. Basically, you use the command line executable file called LIB.exe in the Microsoft Visual Studio\VC98\bin directory. Try typing "import library" into the MSDN index and there are several topics there "building", "creating", "using", "linker files", etc. I don't know what the link is for it on MSDN online. Edit: I found it http://msdn.microsoft.com/library/en-us/vccore98/html/_core_working_with_import_libraries_and_export_files.asp[^]

                T 1 Reply Last reply
                0
                • J JohnnyG

                  I'm not sure I understand your question but if you're asking if there is a way to create a .lib file from a dll file, I think I found your answer. Basically, you use the command line executable file called LIB.exe in the Microsoft Visual Studio\VC98\bin directory. Try typing "import library" into the MSDN index and there are several topics there "building", "creating", "using", "linker files", etc. I don't know what the link is for it on MSDN online. Edit: I found it http://msdn.microsoft.com/library/en-us/vccore98/html/_core_working_with_import_libraries_and_export_files.asp[^]

                  T Offline
                  T Offline
                  Ted Ferenc
                  wrote on last edited by
                  #8

                  Yes that was "my" solution, in simple terms, I HAVE NOT TESTED THIS, the info is from my very old notes dumpbin /Exports mydll.dll create mydll.def from this, format:- funct1@4 @42 funct2@2 @43 where func1 is the function name, @4 is the size of the function arguments, in bytes, @42 is the ordinal/ lib /MACHINE:i386 /DEF mydll.def This next line I am guessing at, the new header file:- __declspec(dllimport) BOOL __stdcall func1(char[4]);


                  If I have seen further it is by standing on the shoulders of Giants. - Isaac Newton 1676

                  V 1 Reply Last reply
                  0
                  • T Ted Ferenc

                    Yes that was "my" solution, in simple terms, I HAVE NOT TESTED THIS, the info is from my very old notes dumpbin /Exports mydll.dll create mydll.def from this, format:- funct1@4 @42 funct2@2 @43 where func1 is the function name, @4 is the size of the function arguments, in bytes, @42 is the ordinal/ lib /MACHINE:i386 /DEF mydll.def This next line I am guessing at, the new header file:- __declspec(dllimport) BOOL __stdcall func1(char[4]);


                    If I have seen further it is by standing on the shoulders of Giants. - Isaac Newton 1676

                    V Offline
                    V Offline
                    Valera241176
                    wrote on last edited by
                    #9

                    :)Thanks for all who help me to find a solution of this task. After a little correction of Ted's solution, finally I've made the .lib for my dll and link it successfully to VC++ project. Ted's solution with corrections: dumpbin /Exports mydll.dll create mydll.def from this, format:- EXPORTS funct1@4 @42 funct2@2 @43 where func1 is the function name, @4 is the size of the function arguments, in bytes, @42 is the ordinal/ lib /MACHINE:i386 /DEF:mydll.def /NAME:mydll.dll This next line I am guessing at, the new header file:- __declspec(dllimport) BOOL __stdcall func1(char[4]);

                    T 1 Reply Last reply
                    0
                    • V Valera241176

                      :)Thanks for all who help me to find a solution of this task. After a little correction of Ted's solution, finally I've made the .lib for my dll and link it successfully to VC++ project. Ted's solution with corrections: dumpbin /Exports mydll.dll create mydll.def from this, format:- EXPORTS funct1@4 @42 funct2@2 @43 where func1 is the function name, @4 is the size of the function arguments, in bytes, @42 is the ordinal/ lib /MACHINE:i386 /DEF:mydll.def /NAME:mydll.dll This next line I am guessing at, the new header file:- __declspec(dllimport) BOOL __stdcall func1(char[4]);

                      T Offline
                      T Offline
                      Ted Ferenc
                      wrote on last edited by
                      #10

                      Thanks for fixing "my" solution!:) I have updated my notes now!


                      If I have seen further it is by standing on the shoulders of Giants. - Isaac Newton 1676

                      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