Linking options

  • Thread starter Thread starter Cameron
  • Start date Start date
C

Cameron

Is it possible to do a static link when building an executable? I have a
little application that uses 3 or 4 of my custom DLLs. I would like to
distribute the executable but to have to distribute it and these 3 or 4
other files is a pain. I would prefer if the executable was bigger and
contained the nessissary pieces of the DLLs as required so that I would
only have to distribute a single file. In C++ you can do this with
static linking so I was just wondering if somethign equivelenet was
available?

Thanks

-Cam
 
Hi Cameron,

You have 3 options

1) Link all source files to one VS.NET project (literally add them into
he project as linked source files - it's an option on the drop down
menu of the Add Existing file dialog box - see the down triangle on the
"open" button? Worst option placement ever!), if in fact you are using
VS.NET. This will compile it all together, of coruse.

2) If you use the command-line c# compiler you can build your satellite
projects into *modules*, not assemblies (an option not available in
VS.NET) then compile ('link') those modules into your final assembly.
See the csc.exe command line help for details.

3) Use Salamander .NET Linker, which will walk all dependancies and in
the C sense link all custom, base class and CLR native code into one
natively executable file (no .NET runtime required). Just google it.
It's expensive and I haven't validated its claims.

Richard
 
Hi
It is possible to do a static link when building an executable exactly like
we used to link static .lib files to executables and DLLs. All you need to
do is to compile your dll source files into modules. You will need to use
/target:module command line option for building modules. For more
information on compiling into modules please see the C# compiler manual or
C# compiler command line help. Later while building the executable you can
add those modules into your executable using the /addmodule command line
option.
best,
Subin Kushle
GAPS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top