Setting LARGEADRESSAWARE with macro

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,
I can not set the LARGEADRESSAWARE linker setting using the macro suggested
by microsoft:

' add reference to Microsoft.VisualStudio.VCProjectEngine
Imports EnvDTE
Imports Microsoft.VisualStudio.VCProjectEngine

Public Module Module1
Sub Test()
Dim prj As VCProject
Dim cfgs, tools As IVCCollection
Dim cfg As VCConfiguration
Dim tool As VCLinkerTool
prj = DTE.Solution.Projects.Item(1).Object
cfgs = prj.Configurations
cfg = cfgs.Item(1)
tool = cfg.Tools("VCLinkerTool")
tool.LargeAddressAware = addressAwarenessType.addrAwareNoLarge
End Sub
End Module

I get "specified cast not valid" when trying to create the VCProject. I
guess it mean I can not create a c# project as a c++ project? Anyone know how
to modify the macro for c#? Or any oter suggestions how to set
LARGEADRESSAWARE inside visual studio?
Greatefull for answers
Karl Daggfeldt
 
KalleD said:
Hello,
I can not set the LARGEADRESSAWARE linker setting using the macro
suggested
by microsoft:

' add reference to Microsoft.VisualStudio.VCProjectEngine
Imports EnvDTE
Imports Microsoft.VisualStudio.VCProjectEngine

Public Module Module1
Sub Test()
Dim prj As VCProject
Dim cfgs, tools As IVCCollection
Dim cfg As VCConfiguration
Dim tool As VCLinkerTool
prj = DTE.Solution.Projects.Item(1).Object
cfgs = prj.Configurations
cfg = cfgs.Item(1)
tool = cfg.Tools("VCLinkerTool")
tool.LargeAddressAware = addressAwarenessType.addrAwareNoLarge
End Sub
End Module

I get "specified cast not valid" when trying to create the VCProject. I
guess it mean I can not create a c# project as a c++ project? Anyone know
how
to modify the macro for c#? Or any oter suggestions how to set
LARGEADRESSAWARE inside visual studio?
Greatefull for answers
Karl Daggfeldt

Why a macro? You simply have to set the option in the linker command line of
the VC project. Or am I missing something?

Willy.
 
Hi Willy
I do not know if I understand you exactly.
I can make the setting outside visual studio, using the comandline, but I
would like to have it set automatically when I build the project inside
visual studio. If you mean that there is a comand line for c# project linker
options inside visual studio, I would be super happy if you could locate it
for me.
Sincerely
Karl
 
I can make the setting outside visual studio, using the comandline, but I
would like to have it set automatically when I build the project inside
visual studio. If you mean that there is a comand line for c# project linker
options inside visual studio, I would be super happy if you could locate it
for me.

C# doesn't have a link step, and the compiler doesn't have the option
to set the LARGEADDRESSAWARE flag. I think you have to do that with
Editbin.exe (you can run it as a post-build step).



Mattias
 
Thanks Mattias,
I am using editbin, I just hoped to be able to do it inside VS.
But you are right, the macro I was trying to use probably only work for C++
projects.
Karl
 
Thanks Mattias,
I am using editbin, but hoped to be able to do the setting inside V studio.
But you are correct, the macro I was trying to use is probably not
modifiable for c# projects.
Karl
 
KalleD said:
Hi Willy
I do not know if I understand you exactly.
I can make the setting outside visual studio, using the comandline, but I
would like to have it set automatically when I build the project inside
visual studio. If you mean that there is a comand line for c# project
linker
options inside visual studio, I would be super happy if you could locate
it
for me.
Sincerely
Karl

Like I said before on another thread C# doen't have this option, only C/C++
has it.
If you need to set this option for a c# executable, you have to call
editbin.exe in a post build step.
Note that, as said before, this option doesn't buy you anything if your
intention is to create huge (> 1 GB, and probably less) byte array's, due to
fragmentation and DLL basing.

Willy.
 
Willy,
I have used editbin since the time I wrote about it in the earlier thread
you mentioned. Although not the subject here, I can inform you that it works
fine to generate chunks up to 1.2 Gb.
Karl
 
KalleD said:
Willy,
I have used editbin since the time I wrote about it in the earlier thread
you mentioned. Although not the subject here, I can inform you that it
works
fine to generate chunks up to 1.2 Gb.
Karl

Kalle,

Glad it works, but be prepared that it's not granted to work all the time,
just load a native DLL in your process and "bang', your massive free space
is cut in pieces. Another anoying thing with the 4Gb Ram tuning is that you
never get a larger chunk than what you get without the 4Gb.

Willy.
 
Back
Top