This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
Re: DLL and external symbols
- From: Larry Hall <cygwin-lh at cygwin dot com>
- To: Jani Tiainen <jani dot tiainen at keypro dot fi>, cygwin at cygwin dot com
- Date: Tue, 30 Dec 2003 23:03:11 -0500
- Subject: Re: DLL and external symbols
- References: <3FF1EFB3.5000509@keypro.fi>
- Reply-to: Cygwin List <cygwin at cygwin dot com>
At 04:35 PM 12/30/2003, Jani Tiainen you wrote:
>Hi,
>
>I'm sure that this has been answered several times, but I'll ask again because couldn't find any solution by myself.
>
>I would like to build DLL (or any other sort of library) that refers to external symbols in main application.
>
>So far I have been able to build non-working constructs. =)
>
>Let's say that I've two files:
>
>main.c:
>
>#include <stdio.h>
>
>extern void funcInMyLib(int);
>
>void funcInMain(int i)
>{
> printf("funcInMain(%ld)\n", i);
>}
>
>int main(int argc, char **argv)
>{
> funcInMyLib(1);
> return 0;
>}
>
>and second file (library)
>
>mylib.c:
>extern void funcInMain(int);
>
>void funcInMyLib(int i)
>{
> printf("Calling back...");
> funcInMain(i + 1);
>}
>
>--------
>
>Now how I can get this working, or is it possible at all?
It's possible but you have to move "funcInMain()" into the DLL with
"funcInMyLib()" or into another DLL. That's the straight-forward
answer.
--
Larry Hall http://www.rfk.com
RFK Partners, Inc. (508) 893-9779 - RFK Office
838 Washington Street (508) 893-9889 - FAX
Holliston, MA 01746
--
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/