This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Cygwin dll initialization from win32 application


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]