delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/03/11/12:48:27

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
From: "Rich LeGrand" <rich AT charmedlabs DOT com>
To: <cygwin AT cygwin DOT com>
Subject: Cygwin dll initialization from win32 application
Date: Tue, 11 Mar 2003 12:48:15 -0500
Message-ID: <ALEFICMPOAICDGJBCPJEMEEBCCAA.rich@charmedlabs.com>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
Importance: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019