delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/02/06/17:47:53

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
X-Originating-IP: [198.108.5.3]
From: "C. Throne" <bluemonkey23 AT hotmail DOT com>
To: cygwin AT cygwin DOT com
Subject: problem building dll
Date: Tue, 06 Feb 2001 22:46:17 -0000
Mime-Version: 1.0
Message-ID: <F142HI1VHt8fddAkOhw00007e54@hotmail.com>
X-OriginalArrivalTime: 06 Feb 2001 22:46:17.0328 (UTC) FILETIME=[9DC84F00:01C0908E]

Hello,

I am experimenting with cygwin and attempting
to build a dll.  The following is my build
script:
gcc -g -c dll_main.c
gcc -g -c main.c
gcc -s -Wl,--base-file,testdll.base -o testdll.dll dll_main.o 
-Wl,-e,_lib_main AT 12
dlltool --base-file testdll.base --def testdll.def --output-exp testdll.exp 
--dllname testdll.dll
gcc -s -Wl,--base-file,testdll.base,testdll.exp -o testdll.dll dll_main.o 
-Wl,-e,_lib_main AT 12
dlltool --base-file testdll.base --def testdll.def --output-exp testdll.exp 
--dllname testdll.dll
gcc -Wl,testdll.exp -o testdll.dll dll_main.o -Wl,-e,_lib_main AT 12
dlltool --def testdll.def --dllname testdll.dll --output-lib testdll.a
gcc -o doit.exe main.o testdll.a


When I run the doit.exe executable I get the following
error:
      0 [main] doit 267 handle_exceptions: Exception: 
STATUS_ACCESS_VIOLATION
  92622 [main] doit 267 stackdump: Dumping stack trace to doit.exe.stackdump

I am trying to figure out what I am doing wrong, I
am pretty sure that I am following the directions
listed on the Cygwin site for building a DLL.

The following is my dll_main.c and testdll.def files:
//dll_main.c
#include <windows.h>
static int tester = 0;
int WINAPI lib_main(HANDLE h, DWORD reason, void *unused)
{
   tester = 5;
   return 1;
}

int main (int argc, char ** argv)
{
   return 0;
}

int dummy_function(char *tempBuffer)
{
   tempBuffer[0] = 'A';
   tempBuffer[1] = 'B';
   tempBuffer[2] = 'C';
   tempBuffer[3] = 0;
   lstrcpy(tempBuffer, "Hi Ma");
   return tester;
}

;testdll.def
LIBRARY testdll
EXPORTS
	dummy_function

When I run things through gdb it looks like everything
is dying on the call to lstrcpy.  Any external function
appears to crash my program (printf, strcpy, strcat ...).

Any help would be greatly appreciated.

Thanks,
--Craig
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com


--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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