Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411490 Posts in 69377 Topics- by 58433 Members - Latest Member: graysonsolis

April 29, 2024, 01:27:56 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Distributing MSVC-compiled applications
Pages: [1]
Print
Author Topic: Distributing MSVC-compiled applications  (Read 3300 times)
Ivan
Owl Country
Level 10
*


alright, let's see what we can see


View Profile
« on: April 04, 2009, 11:23:46 AM »

Ok, so this is something I've been confused about for a long time and I can't seem to get a straight answer.

What is the proper way to distribute the MSVC runtimes when you're distributing your application? I thought that including the runtime dlls in your directory is enough, but from I understand, some people can still have problems with that. The proper way seems to be to include the runtime installer, but that's not very nice if you're distributing your app without an installer.

There are plenty of windows applications that run just fine without any runtime installation and there are many that don't even include the runtime dlls in their folder. Are they just compiled with an older version of MSVC? (I'm using the latest express edition).
Logged

http://polycode.org/ - Free, cross-platform, open-source engine.
Hideous
That's cool.
Level 10
*****


3D models are the best


View Profile WWW
« Reply #1 on: April 04, 2009, 11:37:07 AM »

Quote
There are plenty of windows applications that run just fine without any runtime installation and there are many that don't even include the runtime dlls in their folder.

Well, they don't have to be compiled with MSVC, you know.
Logged

Ivan
Owl Country
Level 10
*


alright, let's see what we can see


View Profile
« Reply #2 on: April 04, 2009, 11:40:31 AM »

Quote
There are plenty of windows applications that run just fine without any runtime installation and there are many that don't even include the runtime dlls in their folder.

Well, they don't have to be compiled with MSVC, you know.

I'm assuming you're talking about MingW?

The problem with MingW is that it statically links the runtime (I think, anyway), which seems to lead to runtime issues as well.
Logged

http://polycode.org/ - Free, cross-platform, open-source engine.
Snakey
Level 2
**


View Profile WWW
« Reply #3 on: April 04, 2009, 01:08:03 PM »

People sometimes just have them installed due to other programs or applications. You can use some ancient version of said runtime libraries but it isn't a good way to do it. Without an installer, there isn't too much you can do other than packaging it up together with the zip file. I've opted to distributing BqEd using two methods, a ZIP and an Installer.
Logged

I like turtles.
David Pittman
Level 2
**


MAEK GAEM


View Profile WWW
« Reply #4 on: April 04, 2009, 01:12:39 PM »

Change your project properties to link to the static CRT library instead of dynamic (/MT instead of /MD, for example). Your executable will be a bit bigger, but you won't need to distribute the DLLs.

I think that's all it takes, anyway. Haven't messed with that stuff in a while.

http://msdn.microsoft.com/en-us/library/abx4dbyh(VS.80).aspx

(I realize that doesn't actually answer your question of how to distribute the DLLs, but it also means you don't need to. Shrug)
Logged

Ivan
Owl Country
Level 10
*


alright, let's see what we can see


View Profile
« Reply #5 on: April 04, 2009, 02:03:20 PM »

But doesn't that mean you can't link to libraries compiled as /MD?
Logged

http://polycode.org/ - Free, cross-platform, open-source engine.
David Pittman
Level 2
**


MAEK GAEM


View Profile WWW
« Reply #6 on: April 04, 2009, 04:05:56 PM »

Ah, yeah, that would be a problem.

I checked out the Landfall demo and it looks like the problem might be a manifest issue similar to what's described here. The manifest embedded in the exe references version 9.0.21022.8, and the DLLs you've included are 9.0.30729.1.
Logged

lithander
Level 3
***


View Profile WWW
« Reply #7 on: April 04, 2009, 04:49:57 PM »

Almost any installer for dependency libs can be executed in silent mode. Maybe you can just run it at the first start of your application instead of from within an installer.
Logged

muku
Level 10
*****


View Profile
« Reply #8 on: April 04, 2009, 10:35:04 PM »

Almost any installer for dependency libs can be executed in silent mode. Maybe you can just run it at the first start of your application instead of from within an installer.

I would consider it pretty rude of a developer to install stuff on my machine without my knowledge.
Logged
Mikademus
Level 10
*****


The Magical Owl


View Profile
« Reply #9 on: April 05, 2009, 04:12:43 PM »

Almost any installer for dependency libs can be executed in silent mode. Maybe you can just run it at the first start of your application instead of from within an installer.

I would consider it pretty rude of a developer to install stuff on my machine without my knowledge.

Agreed, which is why I never buy games that install DRM rootkits or whatever nasties without my consent (actually, I don't buy any games with that kind of shit, period, but let's not open that can of worms). Instead, have you tried detecting if the required libraries are missing and ask for permission to install them (call their installers)?
Logged

\\\"There\\\'s a tendency among the press to attribute the creation of a game to a single person,\\\" says Warren Spector, creator of Thief and Deus Ex. --IGN<br />My compilation of game engines for indies
Snakey
Level 2
**


View Profile WWW
« Reply #10 on: April 06, 2009, 02:28:49 PM »

Well that's the problem Mikademus, you could write a program which tries to detect for missing libraries ... but the detection program if you were to write one would need the libraries! Perhaps there is one distributed by Microsoft.
Logged

I like turtles.
Will Vale
Level 4
****



View Profile WWW
« Reply #11 on: April 07, 2009, 04:20:49 PM »

I read about this on the MS site a while back - I'm pretty sure that you have to use the appropriate redist installer to get the DLLs onto the machine - just sticking stuff in a folder might be against your license agreement.

The WinSxS stuff makes installing multiple versions pretty straightforward. My plan for approaching this next time was to have the installer provide web links to the correct downloads (or possibly do a silent install-off-web in basic mode) to avoid bloating it unnecessarily.

[edit] The MS installers for redists, DirectX etc. don't do anything if you have the stuff installed already, so you can in theory just run them without needing to detect first - that should be a lot safer and easier than trying to detect and maybe getting it wrong.

For the people who don't like having stuff installed without their permission, what do you suggest as an alternative? Dependencies are dependencies, you can't run the game without them after all. Is offering the option enough, with the caveat that "the game will crash if you don't do this"?

Cheers,

Will

Logged
Snakey
Level 2
**


View Profile WWW
« Reply #12 on: April 08, 2009, 12:38:44 AM »

Well the problem is easily solved with installers, but it's when you have people who want ZIP versions as they want to control where things go...
Logged

I like turtles.
Gravious
Level 2
**


"Swedish meatballs"


View Profile WWW
« Reply #13 on: April 08, 2009, 05:47:44 AM »

Installers let you control where things go Tongue (most of the time)
Logged

One day I'll think about doing something to stop procrastinating.
Frog
Level 1
*


Eternal Being


View Profile WWW
« Reply #14 on: April 13, 2009, 04:53:34 AM »

I've never had a problem with this. Just switch your compiler from debug to release mode.
Logged
Bob le Moche
Level 0
***



View Profile WWW
« Reply #15 on: April 13, 2009, 08:16:02 AM »

I always do it the way David recommends, and for the libraries I just compile them myself with /MT so they link correctly. It's really simple and easy compared to trying to distribute the DLLs which is a pain in the ass and never works correctly.

For those that don't know what I'm talking about: just go in your project properties -> Configuration-> C/C++ -> Code Generation and under "runtime library" choose the non-DLL version (/MT). Make sure you're changing the setting for the release configuration. Your executable will then contains everything it needs to run on another computer.
Logged
Ivan
Owl Country
Level 10
*


alright, let's see what we can see


View Profile
« Reply #16 on: April 13, 2009, 09:53:40 AM »

I always do it the way David recommends, and for the libraries I just compile them myself with /MT so they link correctly. It's really simple and easy compared to trying to distribute the DLLs which is a pain in the ass and never works correctly.

For those that don't know what I'm talking about: just go in your project properties -> Configuration-> C/C++ -> Code Generation and under "runtime library" choose the non-DLL version (/MT). Make sure you're changing the setting for the release configuration. Your executable will then contains everything it needs to run on another computer.

As far as I understand, you cannot do this if you're using MD compiled libraries? Or am I just grossly mistaken?
Logged

http://polycode.org/ - Free, cross-platform, open-source engine.
David Pittman
Level 2
**


MAEK GAEM


View Profile WWW
« Reply #17 on: April 13, 2009, 09:59:55 AM »

I always do it the way David recommends, and for the libraries I just compile them myself with /MT so they link correctly. It's really simple and easy compared to trying to distribute the DLLs which is a pain in the ass and never works correctly.

For those that don't know what I'm talking about: just go in your project properties -> Configuration-> C/C++ -> Code Generation and under "runtime library" choose the non-DLL version (/MT). Make sure you're changing the setting for the release configuration. Your executable will then contains everything it needs to run on another computer.

As far as I understand, you cannot do this if you're using MD compiled libraries? Or am I just grossly mistaken?

No, you're right. If you don't have source to rebuild the libraries and they're only distributed compiled with /MD, that won't work. (Though if there is such a library, you should ask the author to make a /MT version available.)

(Actually, I believe you can build it that way and ignore the warnings, there's just the potential for runtime badness because it will be using both versions of the C runtime simultaneously. That's not a problem if the library is well contained. If it's not--for example, if it expects objects allocated internally to be freed by the calling program--this would be a problem because there are two allocators and the object is being freed by the wrong one.)
« Last Edit: April 13, 2009, 10:06:55 AM by David Pittman » Logged

Ivan
Owl Country
Level 10
*


alright, let's see what we can see


View Profile
« Reply #18 on: April 13, 2009, 10:22:03 AM »

Hmm, I thought that the linker actually wouldn't find the symbols from the /MD libs.
Logged

http://polycode.org/ - Free, cross-platform, open-source engine.
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic