Announcement

Collapse
No announcement yet.

Combine a Dll with EXE?

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

  • Combine a Dll with EXE?

    hello,

    i realize this goes against the whole purpose of dll's, but is it
    possible to combine a dll and an exe into one exe? i'm developing
    something that will be sold in dll form, however, i'd like to
    distribute a demo program written with pbdll 6.0 that shows the functionality
    of the dll itself without passing out copies of the dll. is this possible?
    or am i stuck with modifying the dll source code and pasting it into the
    demo program's code?

    is this link what i need?
    http://www.powerbasic.com/support/pb...ead.php?t=1989

    thanks,



    ------------------
    todd wasson
    -------------
    performance simulations
    drag racing and top speed
    prediction software
    http://performancesimulations.com
    Todd Wasson
    http://PerformanceSimulations.Com
    PowerBasic Racing Simulator (October 2007 clip - 15.1MB wmv file) http:http://www.performancesimulations.co...m-GenIV-12.wmv

  • #2
    You probably need this, to do that...
    http://www.collakesoftware.com/pebundle.htm

    ------------------
    Fred
    mailto:[email protected][email protected]</A>
    http://www.oxenby.se

    Fred
    mailto:[email protected][email protected]</A>
    http://www.oxenby.se

    Comment


    • #3
      You might look at restructuring your code slightly to use conditional compiling :

      Code:
      %COMPILE_DEMO = true or false
      
      #INCLUDE "DECLARE.BI"
      
      #IF %COMPILE_DEMO
      #COMPILE EXE
      
        Extra Code Needed to make an EXE, probably something like
        FUNCTION WinMain
        FUNCTION WndProc for test/demo window
      #ELSE
      #COMPILE DLL
         FUNCTION LibMain 
          ...
         END FUNCTION
      #ENDIF
      I have a couple of programs I wrote where I can create a test program (which is not unlike a demo) using this method.

      It takes a little playing around with the order of the declarations, but it was time well spent.


      MCM






      [This message has been edited by Michael Mattias (edited May 14, 2001).]
      Michael Mattias
      Tal Systems (retired)
      Port Washington WI USA
      [email protected]
      http://www.talsystems.com

      Comment


      • #4
        I once combined the WinLift DLL into my main EXE, of course I had the source
        code.

        I changed the DLL entry point to a regular function call...

        Code:
        'FUNCTION LibMain& (BYVAL DllInstance&, BYVAL Reason&, BYVAL Reserved&) EXPORT
        FUNCTION InitMain(BYVAL Reason&) AS LONG
          
            Ret& = %TRUE
         
            IF Reason& = %TRUE THEN
         
        'Comment this out-> hInst& = DllInstance& 
         
        ...etc

        Then in the WinMain start up...
        Code:
            '*Initialize Skin elements, DLL replacement
            CALL InitMain(%TRUE)

        This worked simply enough.

        Regards,
        Jules

        Comment


        • #5
          Thanks everyone for the advice. I think I'll try the program Fred mentioned, as there are
          so many functions in the Dll, it would be a lot of trouble to remove the EXPORT
          keyword and keep two copies that have to both be changed while adding code to it. Thanks a lot
          for the help


          ------------------
          Todd Wasson
          -------------
          Performance Simulations
          Drag Racing and Top Speed
          Prediction Software
          http://PerformanceSimulations.Com
          Todd Wasson
          http://PerformanceSimulations.Com
          PowerBasic Racing Simulator (October 2007 clip - 15.1MB wmv file) http:http://www.performancesimulations.co...m-GenIV-12.wmv

          Comment


          • #6
            You don't have to remove the word EXPORT when you compile to an EXE.

            It hurts nothing to leave it in.

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

            Comment


            • #7
              True, however the exported sub/function names will be visible in the EXE image, so that may be a consideration, but not one that will affect compilation.

              Personally, I prefer to use conditional compilation, since you can maintain a single source and produce an EXE or a DLL as required.



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

              Comment


              • #8
                So basically, I could just paste the DLL code into my demo EXE and remove
                the #COMPILE DLL statement? I don't have to worry about the EXPORT statements
                unless I want to prevent someone from seeing the functions?

                Thanks,

                ------------------
                Todd Wasson
                -------------
                Performance Simulations
                Drag Racing and Top Speed
                Prediction Software
                http://PerformanceSimulations.Com
                Todd Wasson
                http://PerformanceSimulations.Com
                PowerBasic Racing Simulator (October 2007 clip - 15.1MB wmv file) http:http://www.performancesimulations.co...m-GenIV-12.wmv

                Comment


                • #9
                  Yes! MCM's post at the start of this thread shows how to do it (in pseudocode).

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

                  Comment

                  Working...
                  X
                  😀
                  🥰
                  🤢
                  😎
                  😡
                  👍
                  👎