Announcement

Collapse
No announcement yet.

Embedding a Dll

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #41
    Lance and Eric,
    I agree that their a lot of benefits to using a setup program.
    The program will show up in the list of installed apps, can be easily
    uninstalled by the control panel, custom dirs, etc...

    However, everyone is stating that a setup.exe is always the better option.
    And I have to strongly disagree. For example I often build utilities
    that need to be ran on hundreds of different PCs, but only once to make
    updates. It would be crazy to 1.)run the setup 2.) run the program
    3.) uninstall it. By embedding the file, I can run my utilities from
    login scripts, it will first check it the update was already done, if
    not it will create any needed DLLs, etc then run the update.(all in
    one step sometimes transparent to the user)

    So again, setup is better 99% of the time, but not always.

    William

    ------------------
    "I haven't lost my mind... its backed up on tape... I think??"
    "I haven't lost my mind... its backed up on tape... I think??" :D

    Comment


    • #42
      David,
      Ill take another look at it. Im sure I used it a while ago. from
      what i remember it was very cool. The only problem is I have to
      got thru all the setup EACH time i send out my app. Thats a pain.
      It does solve the problem of a single app that does not prompt
      the user like an installer tho ... Close but no Cigar

      Borje,
      If you come up with anything pls let me know.

      ------------------
      Kind Regards
      Mike

      Comment


      • #43
        Mike, I think Borje's suggestion would work for you. I have used
        a similar method in the past. The advantage of this approach is
        that since the DLL will exist when the main exe is ran, you can leave
        your implicit declares the way they are. And since your first
        program that runs, has no dependencies on the DLL, you will not get
        the errors you were getting.

        Here is an example: (see my earlier post for a link to the inc file)
        Code:
        #COMPILE EXE
        #RESOURCE "MyResFile.PBR"
        #INCLUDE "MakeFile.INC"
        FUNCTION PBMAIN () AS LONG
          LOCAL zSysDir AS ASCIIZ * %MAX_PATH
          LOCAL NewFile AS STRING
          ' here you could have your program search to see if the files are already there, if so, just run the main exe
          IF GetSystemDirectory(zSysDir,%MAX_PATH) = 0 THEN
             MSGBOX "Failed to get Windows System dir",,"Error"
          ELSE
             NewFile = zSysDir + "\MYDLL.DLL"
             IF MakeFile("MYDLL",NewFile) <> 1 THEN MSGBOX "Failed to create MYDLL.DLL",,"Error"
             IF MakeFile("MYEXE","c:\MyProg.EXE") <> 1 THEN MSGBOX "Failed to create MYProg.EXE",,"Error"
             SHELL "c:\MyProg.exe"
             'here you could possibly use KILL to remove any unwanted temp files
          END IF
        END FUNCTION
        Of course it does add some overhead, and possibly places to break down,
        but if you dont want the setup program, this might be an option.


        ------------------
        "I haven't lost my mind... its backed up on tape... I think??"
        "I haven't lost my mind... its backed up on tape... I think??" :D

        Comment


        • #44
          Will,
          I like leaving the declares the same and the concept is good, but
          think about this. The wrapper EXE cannot have the same name as the
          application EXE because it would have to replace itself. So Im
          shipping an app that goes "pooooof" at run time and disppears to be
          replaced with the real app. Messy, and begs questions from the
          client. I can just hear it now ... "What did I do wrong, the app
          you sent me dissapeared. Please send it again, and again and again"

          Apart from that, I have to do 2 compiles to ship one app,
          not so bad true, but undesirable.

          I fairly certain that what I want to do is EMBED the dang DLL and
          either pull it out at run time and use LOADLIBRARY, or better yet
          load it straight into memory. The former I can do I think, anyone know
          how to do the latter?


          ------------------
          Kind Regards
          Mike

          Comment


          • #45
            Mike, I understand.

            And if you do get it working, I would love to see an example.
            Because in the past I started to try it and read something that made me
            think it wasnt possible, so I dropped it in favor of creating the DLL
            file first.

            But if someone has got it to work, I would also like to see it.
            (I like having more options)

            William

            ------------------
            "I haven't lost my mind... its backed up on tape... I think??"
            "I haven't lost my mind... its backed up on tape... I think??" :D

            Comment


            • #46
              Seems like only solution is to dump the embedded resource DLL to disk in
              order for LoadLibrary to work. And LoadLibrary seems to be needed. Searched
              Google and saw some samples, but all does just this, saves the DLL as a
              hidden file on load and then deletes it at exit.

              Guess that's what those "bundle" programs also do, only they also use
              some sort of compression/decompression routines.


              ------------------

              Comment


              • #47
                But if someone has got it to work, I would also like to see it.
                I've posted here some thoughts on this a couple of times, but just in text format, not in terms of working code. (No, I do not have URLs and I'm not going to try to find them with this BBS search. Maybe POFFS can filter better).

                You say you would like to 'see' it; would you be interested in paying for working code? (I'm thinking about $100 US/copy).

                (As a non-believer, I could only approach this on a mercenary basis).

                MCM
                Michael Mattias
                Tal Systems (retired)
                Port Washington WI USA
                [email protected]
                http://www.talsystems.com

                Comment


                • #48
                  Actually, my "c-selfx" software does this. It is now free including source for download from dickinson.basicguru.com
                  It bundles a bunch of files together into one exe. When executed, it extracts them all and launches the one you tell it to. When that one finishes executing it deletes all of the extracted files. It might be worth a look if you're trying to get everything into one exe. The source requires both pbcc and pbdll to compile.

                  --Don

                  ------------------
                  dickinson.basicguru.com
                  Don Dickinson
                  www.greatwebdivide.com

                  Comment


                  • #49
                    Topic closed due to extreme length. If further discussions are warranted, please start a new topic but be sure to include a link to this topic in the first message.

                    Thanks folks!


                    ------------------
                    Lance
                    PowerBASIC Support
                    mailto:[email protected][email protected]</A>
                    Lance
                    mailto:[email protected]

                    Comment

                    Working...
                    X