How to change stack size?

J

Jensen Somers

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
 
W

Walter Roberson

Jensen Somers said:
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.
 
J

Jensen Somers

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
 
J

Joachim Schmitz

Jensen Somers said:
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
 
W

Walter Roberson


Your question is sounding suspiciously system-specific; I would suggest
that you ask in a newsgroup pertaining to whatever operating system you
are using.
[/QUOTE]
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.
 
K

Kenny McCormack

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!
 
J

jacob navia

Jensen said:
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?
 
K

Kenny McCormack

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.
 

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

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top