Cygwin dll initialization from win32 application
Rich LeGrand
rich@charmedlabs.com
Tue Mar 11 18:29:00 GMT 2003
Hi all,
This has been discussed before, but I have been unable to find any solutions
to this problem.
Basically I'm trying to call cygwin functions in the cygwin1.dll from a
Windows (msvc) application by calling LoadLibrary() and GetProcAddress().
I can see that the cygwin authors have made provision for this (or what
looks like a provision) with dll_dllcrt0 (a non-cygwin initialization
function.) But when I call it, it crashes.
Here is my code:
per_process p;
ZeroMemory((void *)&p, sizeof(per_process));
m_dllHandle = LoadLibrary("cygwin1.dll");
p.calloc = calloc;
p.magic_biscuit = sizeof(per_process);
p.malloc = malloc;
p.realloc = realloc;
p.free = free;
p.hmodule = m_dllHandle;
dll_dllcrt0 = (int (*)(HMODULE, per_process *))GetProcAddress(m_dllHandle,
"dll_dllcrt0");
dll_dllcrt0(m_dllHandle, NULL); // crash here
I'm shooting in the dark mostly -- has anyone had any success with this?
Any help or any code in whatever form would be very much appreciated!
Best regards,
Rich LeGrand
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
More information about the Cygwin
mailing list