Results 1 to 17 of 17

Thread: Compile with all dependencies

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2013
    Posts
    15

    Compile with all dependencies

    WHen I compile my app and run it on another computer im always getting the missing DLL error. Cant I compile the app and include all the DLL's?

  2. #2
    PowerPoster Arnoutdv's Avatar
    Join Date
    Oct 2013
    Posts
    5,906

    Re: Compile with all dependencies

    No you can not bind the external dlls into a single exe using the VB6 compiler.

  3. #3
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,538

    Re: Compile with all dependencies

    Not natvely with VB... there are tools that allow dll packing... results vary... some virus scanners will see such packed exes as a threat and may shut it down. I've also heard of others with success stories with packing. Personally I just go with the tried & true installation program to install the app.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  4. #4
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,600

    Re: Compile with all dependencies

    Quote Originally Posted by ihsaan View Post
    Cant I compile the app and include all the DLL's?
    Compiling a DLL into an EXE defeats the purpose of a DLL in the first place. DLL means dynamic link library. Its meant to be dynamically linked. What you're describing is called static linking. That was the standard way of integrating libraries in the DOS era. However, I think the VC++ compiler can still do static linking.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  5. #5
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: Compile with all dependencies

    Quote Originally Posted by ihsaan View Post
    WHen I compile my app and run it on another computer im always getting the missing DLL error. Cant I compile the app and include all the DLL's?
    What you should be doing is creating an installer package and then installing it on the target system. This way all the dlls, ocxs and other required files are properly installed and registered, shortcuts created, folders created and so on.

  6. #6

    Thread Starter
    New Member
    Join Date
    Mar 2013
    Posts
    15

    Re: Compile with all dependencies

    Thanks guys.. Any particular Installer package you can recommend?

  7. #7
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Compile with all dependencies

    Just start with the Package and Deployment Wizard that comes with every copy of VB6 that can create programs legal to redistribute.

    Ideally after some experience you'd move on to Visual Studio 6.0 Installer 1.1, which was released as a free update to the VB/VS 6.0 products. However the downloads are no longer hosted by Microsoft. There are also high quality 3rd party packaging tools on the market.

    Personally I'd avoid the InnoSetup product several people here are likely to recommend to you. It relies on hand-crafted scripting that is very easy to get wrong, and in my experience is the leading cause of DLL Hell today because of poorly written scripts loose in the wild and blindly copy/pasted by so many novices.

    It gets really old taking support calls from customers to "fix" my applications when some defective InnoSetup package was the culprit. This is so common now I'd prefer that anti-virus tools start treating InnoSetup as malware.

  8. #8
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,600

    Re: Compile with all dependencies

    Quote Originally Posted by ihsaan View Post
    Thanks guys.. Any particular Installer package you can recommend?
    You can try the Visual Studio Installer project templates that come with VS2008 and up. Although they are made to create installers for VB.Net/C# projects, they are flexible enough to create decent enough installers for VB6 applications. They can register COM libraries, alter the registry, create shortcuts. Only caveat is that you're going to have to specify all the dependencies for yourself since it wasn't made with VB6 apps in mind. Also, I think you have to have Pro editions of VS2008 and up to get the installer project template.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  9. #9
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Compile with all dependencies

    Well, if you have the source code of the dlls try adding the classes to the exe and the compiling the executable.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  10. #10
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Compile with all dependencies

    When packaging an application it is also important to know which DLLs are deployable and which ones aren't. A lot has changed since the Win9x days when VB6 first came out, and many things you used to have to deploy are now part of the OS and either can't be or shouldn't be deployed. People get tripped up over the VCRT DLLs quite often for example.

    Reg-free COM packaging is another alternative to conventional installation. But it is an advanced topic since Microsoft never provided simple VB6 tooling for it even though VB6 was the original intended target. Works great in most cases where you need to create "portable" apps or ones that can be installed per-user when no admin rights are available since nothing needs to be registered. This is also useful for getting around DLL Hell even when you create a conventional installer, since you provide private copies of the libraries you need.

    Reg-free COM can make a VB6 application easy to package using the IExpress wizard that ships as part of Windows. You just write a sort of stripped down version of Setup1.exe that copies files from the unpacked temporary location to a folder under %LOCALAPPDATA%\Programs, creates Start Menu shortcuts, etc.

    But in many cases the PDW does a good enough job.

  11. #11
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Compile with all dependencies

    Quote Originally Posted by Niya View Post
    You can try the Visual Studio Installer project templates that come with VS2008 and up.
    You might do some checking.

    Microsoft Removes Installer Project Templates from Visual Studio 2012

    But I don't keep up with VS, so I can't say what the real situation might be today.

  12. #12
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Compile with all dependencies

    Ahh, see:

    Microsoft Re-Installs Visual Studio Installer

    Microsoft has brought back a much-missed bit of functionality from Visual Studio 2010 and put it back in Visual Studio 2013: Visual Studio Installer projects.

    Visual Studio 2013 Requirements

    OS: Windows 8.1 (x86 and x64), Windows 8 (x86 and x64), Windows 7 (x86 and x64), Windows Server 2008 R2 SP1 (x64), Windows Server 2012 (x64)

  13. #13
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,255

    Re: Compile with all dependencies

    Quote Originally Posted by Nightwalker83 View Post
    Well, if you have the source code of the dlls try adding the classes to the exe and the compiling the executable.
    Well, that would be entirely against the principles of "pre-compiled modularization".
    I never understood the obsession of the VB-Community, to have "everything in one Exe" -
    especially not since the advent of regfree loading-approaches for COM-libs.

    Isolated development of Components which are tested and compiled outside the
    Main-Project (outsourcing larger/shared parts of the codebase from the concrete Application,
    not cluttering it with the additional code - and thus ensuring fast startup- and compile-times
    of the main-project) is part of normal engineering and the recommended way to do things.

    COM-libs (ActiveX-Dlls especially) are really nice "interface-selfdescribing binary-containers",
    which in VB(A) only require a single "Check-in-Click" to become immediately usable with intellisense.

    The deployment-part can be done in a \Bin\ SubFolder of the Application itself.
    In case of Dlls the loading of (instancing classes from) such ActiveX-Dlls can be done
    regfree with only a few lines of additional code in your VB-Project.

    Olaf

  14. #14
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,538

    Re: Compile with all dependencies

    I never understood the obsession of the VB-Community, to have "everything in one Exe" -
    especially not since the advent of regfree loading-approaches for COM-libs.
    I've seen it extend from two lines of thinking:

    1) Other languages allow it
    2) lack of understanding that deploying also needs to include the dependencies

    Both have their merits, but that's not the foundation that VB was built on.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  15. #15
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Compile with all dependencies

    Quote Originally Posted by Schmidt View Post
    Well, that would be entirely against the principles of "pre-compiled modularization".
    I never understood the obsession of the VB-Community, to have "everything in one Exe" -
    especially not since the advent of regfree loading-approaches for COM-libs.
    Well, that would depend on what you needed to do with the code! As you know dll files can be used in other applications. Going from memory, compiling an execute project that contains a class does not allow access to the class from outside sources (at least not through normal means).
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  16. #16
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Compile with all dependencies

    At this late date people probably shouldn't be trying to learn VB6 from scratch anyway.

    Microsoft has only gone out of its way just enough to allow old programs to still run, with a little care. With each new Windows version things have gotten a little bit tougher, so if you don't already have a deep investment in VB6 experience I wonder why you aren't looking elsewhere.

    With Windows itself stumbling so much post-Win7 it might even be wise to consider investing your effort into cross-platform languages. There are some easy gateways from the VB world to Java such as B4J.

  17. #17
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,255

    Re: Compile with all dependencies

    Quote Originally Posted by Nightwalker83 View Post
    Well, that would depend on what you needed to do with the code! As you know dll files can be used in other applications. Going from memory, compiling an execute project that contains a class does not allow access to the class from outside sources (at least not through normal means).
    Well, in case you want to develop a "protected" COM-library - the approach would be,
    to include a cFactory - or cConstructor-Class which would be the only Class in your Dll,
    which is included with its Instancing-Property at '5 - MultiUse'...

    All other Classes could be included with Instancing at '3 - PublicNotCreatable'.

    Then only the cConstructor or cFactory Class being able, to hand out Instances of
    those Classes into Applications (then, with e.g. cConstructor.AuthenticateAndEnable
    you could include a Method there, which would require the right credentials, to
    switch the cConstructor-Class into a Mode, which allows the other Constructor-
    methods to hand out new instances of the other Classes (the ones with Instancing = 3).

    Sounds a bit complicated, but can be accomplished with only a few lines of code -
    so (aside from that it's rarely needed) protecting "intellectual Property" in Classes
    of ActiveX-Dlls is not a big deal really.

    Olaf

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width