delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/05/23/05:30:25

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
Message-ID: <001d01c0e36a$711676b0$7800a8c0@liningw2ks>
Reply-To: "Li Ning" <lining AT mail DOT bitmate DOT com>
From: "Li Ning" <lining AT mail DOT bitmate DOT com>
To: <cygwin AT cygwin DOT com>
Subject: DLL problems
Date: Wed, 23 May 2001 17:26:26 +0800
Organization: BitMate
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id FAA18040

Dear friends,

I have been struggled hard to make dll running but failed.
Please help.

My purpose is to trun a cygwin compiled C program into a 
dll, so that I can call it from Microsoft VC or VB.

My environment is: Windows 2K server with cygwin 1.3.2-1 
installed.

Following "Cygwin User's Guide" Chapter 4 "Building and 
Using DLLs", I just tried a small program first:

mydll.c
---------------
int foo (int) __attribute__ ((__dllexport__));
int foo (int i){return i+1;}
---------------

mydll.def
---------------
EXPORTS
foo
---------------

Then I did the following:

gcc -c mydll.c

gcc -s -Wl,--base-file,mydll.base -o mydll.dll mydll.o -Wl,-e,_mydll_init AT 12 

It complains:

/usr/lib/libcygwin.a(libcmain.o)(.text+0x6a):libcmain.c: undefined reference to `WinMain AT 16'
collect2: ld returned 1 exit status

What's rwong?

I have tried other ways to test dlls, I have added cygwin1.dll into the VC
link options to compile a small program, VC complains:

Linking...
cygwin1.dll : fatal error LNK1136: invalid or corrupt file
Error executing link.exe.

Does that mean that there is no way to let VC access cygwin programs?

I would be very appreciate if any one can provide me a complete set of
working demo program to show me the whole process to build a DLL for
Win32 / VC. 

Thanks

Ning Li





- Raw text -


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