Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trouble loading DLL

Status
Not open for further replies.

mcbribm

Programmer
Aug 30, 2002
2
US
Hello,

I'm working with a C program that was ported with the MKS Toolkit/NutCracker. At one point, it uses the "dlopen()" command to load a Windows DLL. This normally works, but I have found a DLL where, when I pass it to this dlopen() command, I am given the error "Not enough storage is available to process this command."

I suspect this is a problem with the DLL, and not with my program. My question is, what might I try to get around this? The DLL is fairly sizeable (18 MB), and contains some static variables. Would increasing the DLL heap size work? I'm new to all this, and I've read on some sites that the DLL heap stores local variable information and is limited to 64K, while other sites seem to indicate that the heap will grow in size as it needs to, and that allocating a specific size during the DLL compilation doesn't have much effect.

Thanks for any insights you might be able to offer. Let me know if this would fit in a better forum.

Brent
 
Brent,
Each executable is limited to a specific default size by the OS. When you dlopen() a library your executable's memory requirements increase by the size of the library. I think your program is running out of memory.
This max size per executable can be increased by the executable. In UNIX we have a command called sbrk()/brk() to do that. I dont know much about windows so I am unaware of the equivalent call.

cheers

amit
crazy_indian@lycos.com

to bug is human to debug devine
 
That might be the case. Does the DLL data, when loaded, get stored on the heap with the application data, or is it stored in a DLL-specific heap? I've read many contradictory articles on this, and I'm a little confused.

Is there a way to prove that I'm exceeding my application's default size? And if so, is there a way that I can increase this size during the compile/link phase? I'd prefer not to add calls to sbrk()/brk() if I can help it. I've re-linked my application with link options that set my application's reserved stack and heap sizes to values much higher than the default values, but that had no effect. I have plenty of free disk space on the machine, and (according to Task Manager) plenty of free RAM as well...

Thanks in advance for any further advice you (or anyone else) can give.

Regards,
Brent
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top