By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,851 Members | 2,097 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,851 IT Pros & Developers. It's quick & easy.

How to change stack size?

P: n/a
Hi,

Is it possible to change the stack size of a DLL from within the source
code? When using threads you can specify the size of the stack you want
the thread to use, but since my application doesn't use threads I'm
looking for another solution.

Source code I haven't written but which I use creates a structure
containing 4 double arrays of almost 30k. I know this is big but it's
required and I cannot change anything about that.

At the moment I change the stack size via the project solution of the IDE
I'm using and it works for me, but when I ship the .dll and .lib file to
someone else he too has to change the stack size in the project solution
of his IDE. This is something I would like to avoid since it's possible
the required stack size might change in the future and I don't want to
bother the users of the DLL with that.

Regards,
Jensen
Jun 5 '07 #1
Share this Question
Share on Google+
9 Replies


P: n/a
In article <k_*********************@giganews.com>,
Jensen Somers <us****@jsomers.bewrote:
>Is it possible to change the stack size of a DLL from within the source
code?
What's a stack? What's a DLL?
>When using threads you can specify the size of the stack you want
the thread to use, but since my application doesn't use threads I'm
looking for another solution.
What are threads?
>Source code I haven't written but which I use creates a structure
containing 4 double arrays of almost 30k. I know this is big but it's
required and I cannot change anything about that.

At the moment I change the stack size via the project solution of the IDE
I'm using and it works for me, but when I ship the .dll and .lib file to
What's an IDE? What's a .dll file? What's a .lib file? What's a
"project solution of the IDE"?
>someone else he too has to change the stack size in the project solution
of his IDE. This is something I would like to avoid since it's possible
the required stack size might change in the future and I don't want to
bother the users of the DLL with that.

Your question is sounding suspiciously system-specific; I would suggest
that you ask in a newsgroup pertaining to whatever operating system
you are using. C itself does not use any of the terms I pointed out
(no, not even "stack" -- there are C implementations which do
not use stacks), but those terms are perhaps used in some specific
implementations.
--
"law -- it's a commodity"
-- Andrew Ryan (The Globe and Mail, 2005/11/26)
Jun 5 '07 #2

P: n/a
On Tue, 05 Jun 2007 19:22:14 +0000, Walter Roberson wrote:
>
Your question is sounding suspiciously system-specific; I would suggest
that you ask in a newsgroup pertaining to whatever operating system you
are using. C itself does not use any of the terms I pointed out (no, not
even "stack" -- there are C implementations which do not use stacks),
but those terms are perhaps used in some specific implementations.
I know, at the moment I focus on MS Windows since the Linux
implementation of the library uses threads and doesn't have this problem
anymore.
If I ask this in an OS specific newsgroup people point me to the C
newsgroups and at the end I don't know where to ask anymore.

Regards,
Jensen

Jun 5 '07 #3

P: n/a
"Jensen Somers" <us****@jsomers.beschrieb im Newsbeitrag
news:G-******************************@giganews.com...
On Tue, 05 Jun 2007 19:22:14 +0000, Walter Roberson wrote:
>>
Your question is sounding suspiciously system-specific; I would suggest
that you ask in a newsgroup pertaining to whatever operating system you
are using. C itself does not use any of the terms I pointed out (no, not
even "stack" -- there are C implementations which do not use stacks),
but those terms are perhaps used in some specific implementations.

I know, at the moment I focus on MS Windows since the Linux
implementation of the library uses threads and doesn't have this problem
anymore.
If I ask this in an OS specific newsgroup people point me to the C
newsgroups and at the end I don't know where to ask anymore.
If someone points you to comp.lang.c for this question (s)he simply wrong.

Bye, Jojo
Jun 5 '07 #4

P: n/a
In article <G-******************************@giganews.com>,
Jensen Somers <us****@jsomers.bewrote:
[earlier]
>>>Is it possible to change the stack size of a DLL from within the source
code? When using threads you can specify the size of the stack you want
the thread to use, but since my application doesn't use threads I'm
looking for another solution.
>On Tue, 05 Jun 2007 19:22:14 +0000, Walter Roberson wrote:
>Your question is sounding suspiciously system-specific; I would suggest
that you ask in a newsgroup pertaining to whatever operating system you
are using.
>I know, at the moment I focus on MS Windows since the Linux
implementation of the library uses threads and doesn't have this problem
anymore.
If I ask this in an OS specific newsgroup people point me to the C
newsgroups and at the end I don't know where to ask anymore.

Well, for what it's worth, my off-topic answer to your question is NO.

http://support.microsoft.com/kb/932909

The maximum stack size of a thread is not determined by an
individual ISAPI, DLL, or ASP component that is running inside
the process. The maximum stack size of a thread is configured by
the executable file of the process.
http://msdn2.microsoft.com/en-us/library/aa461430.aspx

(on use of a /F compiler option to set the program stack size)

Other ways to set the stack size

Using the /STACK linker option.
Using EDITBIN on the .exe file.
Notice the lack of listing of any API option.
But you should consider my "NO" answer to be low quality and unproven,
as I never develop in Windows, and Microsoft's site contradicts itself
regularily (or to be more charitable, that I might have only found
older documentation and possibly XP or Vista has a way to do it.)

My answer was derived entirely from a bit of googling of
site:microsoft.com with keywords set stack size

If you rely on my answer for a question of this importance to you,
then you would be making a mistake. You need something system specific
to MS Windows, and the only reason I keep a Windows system around
is to drive my printer.
--
I was very young in those days, but I was also rather dim.
-- Christopher Priest
Jun 5 '07 #5

P: n/a
Jensen Somers wrote:
>
Is it possible to change the stack size of a DLL from within the
source code? When using threads you can specify the size of the
stack you want the thread to use, but since my application doesn't
use threads I'm looking for another solution.
The C standard doesn't mention DLL nor a stack. Thus you are
off-topic. Try a newsgroup that deals with your system.

--
<http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfocus.com/columnists/423>
<http://www.aaxnet.com/editor/edit043.html>
<http://kadaitcha.cx/vista/dogsbreakfast/index.html>
cbfalconer at maineline dot net

--
Posted via a free Usenet account from http://www.teranews.com

Jun 6 '07 #6

P: n/a
In article <46***************@yahoo.com>,
CBFalconer <cb********@maineline.netwrote:
>Jensen Somers wrote:
>>
Is it possible to change the stack size of a DLL from within the
source code? When using threads you can specify the size of the
stack you want the thread to use, but since my application doesn't
use threads I'm looking for another solution.

The C standard doesn't mention DLL nor a stack. Thus you are
off-topic. Try a newsgroup that deals with your system.
I assume the word 'newsgroup' doesn't appear in the C standard either.
Thus, you are off-topic.

I would imagine that it would be easy enough to build a concordance of
the words found in the C standard, and then to write a newsgroup scanner
that would check each post for compliance with said concordance. The
scanner would then, of course, post an appropriate response to the
newsgroup, either pointing out the off-topic words (thereby rendering
CBFalconer redundant) or, in the extremely unlikely event that all words
passed, would say something like "Good Job!! You are officially on-topic!"

I would not be surprised to find that one or more of the regulars have
already done this. If not, get on it!

Jun 6 '07 #7

P: n/a
Jensen Somers wrote:
Hi,

Is it possible to change the stack size of a DLL from within the source
code? When using threads you can specify the size of the stack you want
the thread to use, but since my application doesn't use threads I'm
looking for another solution.

Source code I haven't written but which I use creates a structure
containing 4 double arrays of almost 30k. I know this is big but it's
required and I cannot change anything about that.

At the moment I change the stack size via the project solution of the IDE
I'm using and it works for me, but when I ship the .dll and .lib file to
someone else he too has to change the stack size in the project solution
of his IDE. This is something I would like to avoid since it's possible
the required stack size might change in the future and I don't want to
bother the users of the DLL with that.

Regards,
Jensen
The stack size is allocated at startup. It is by default 1MB so it is
difficult to understand what is your problem... 30K should not make
a big difference.

I am speaking about 32 bit windows of course. Are you using 16 bit
systems?
Jun 6 '07 #8

P: n/a
jacob navia wrote:
Jensen Somers wrote:
>>
Is it possible to change the stack size of a DLL from within the
source code? When using threads you can specify the size of the
stack you want the thread to use, but since my application doesn't
use threads I'm looking for another solution.
.... snip ...
>
The stack size is allocated at startup. It is by default 1MB so it
is difficult to understand what is your problem... 30K should not
make a big difference.

I am speaking about 32 bit windows of course. Are you using 16 bit
systems?
Once more, this is off-topic, and you should have simply referred
him to a suitable news-group. I'm in a bad mood today.

--
<http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfocus.com/columnists/423>
<http://www.aaxnet.com/editor/edit043.html>
<http://kadaitcha.cx/vista/dogsbreakfast/index.html>
cbfalconer at maineline dot net

--
Posted via a free Usenet account from http://www.teranews.com

Jun 6 '07 #9

P: n/a
In article <46***************@yahoo.com>,
CBFalconer <cb********@maineline.netwrote:
>jacob navia wrote:
>Jensen Somers wrote:
>>>
Is it possible to change the stack size of a DLL from within the
source code? When using threads you can specify the size of the
stack you want the thread to use, but since my application doesn't
use threads I'm looking for another solution.
... snip ...
>>
The stack size is allocated at startup. It is by default 1MB so it
is difficult to understand what is your problem... 30K should not
make a big difference.

I am speaking about 32 bit windows of course. Are you using 16 bit
systems?

Once more, this is off-topic, and you should have simply referred
him to a suitable news-group. I'm in a bad mood today.
Geez. Words just fail me.
You see, there are these things call lives. You can get one (yes, even
you). There is also this thing called sunshine. It is out there,
waiting for you to go out and enjoy it.

Jun 6 '07 #10

This discussion thread is closed

Replies have been disabled for this discussion.