delorie.com/archives/browse.cgi | search |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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 |
Date: | Sun, 11 Jul 2004 02:13:46 +1200 |
From: | Danny Smith <dannysmith AT clear DOT net DOT nz> |
Subject: | Re: Building DLL |
To: | boekhold AT emirates DOT net DOT ae |
Cc: | Cygwin <cygwin AT cygwin DOT com> |
Reply-to: | Danny Smith <dannysmith AT users DOT sourceforge DOT net> |
Message-id: | <000701c46688$1e8c19a0$b56d65da@DANNY> |
MIME-version: | 1.0 |
Maarten wrote > Sorry, searched for that, but couldn't come up with any references of > using dlltool in combination with an executable. Try this: ========================================================== /* dll.c */ #include <stdio.h> extern __attribute__ ((__dllimport__)) void exe_hello(void); void __attribute__ ((__dllexport__)) dll_hello (void) { printf ("Are you there, exe?\n"); exe_hello(); } ========================================================== /* dll.def */ LIBRARY my_dll.dll IMPORTS exe_hello = my_exe.exe.exe_hello ========================================================== /* exe.c */ #include <stdio.h> extern void __attribute__ ((dllexport)) dll_hello (void); void __attribute__ ((dllexport)) exe_hello () { printf ("Yes, the exe is here,\n"); } int main() { dll_hello(); return 0; } ========================================================== gcc -shared -o my_dll.dll dll.def dll.c gcc -o my_exe.exe exe.c my_dll.dll You can do the same thing with import libs if you want, but using a def file is much simpler. Danny -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |