delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/09/18/15:53:08

Message-Id: <200109181953.PAA25697@delorie.com>
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
From: "Mark Paulus" <commpg AT yahoo DOT com>
To: "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com>
Date: Tue, 18 Sep 2001 13:50:11 -0600
Reply-To: "Mark Paulus" <commpg AT yahoo DOT com>
X-Mailer: PMMail 2000 Professional (2.20.2350) For Windows 2000 (5.0.2195;2)
MIME-Version: 1.0
Subject: What's Diff between shared lib (.so) and .dll???

I've been trying to work out this example of how to 
make makefiles and shared library modules that are at least slightly
portable between linux and cygwin.  But, I'm having some 
difficulty.

I have the following 3 code segments:
=======================================
result.cc
=======================================
#include <stdio.h>
#include <unistd.h>
#include <iostream.h>

#include "result.h"

int main () {}

int doit (int a, int b, int c)
{
    cout << "doit: "
         << "a = " << a
         << "b = " << b
         << "c = " << c
         << endl;
    return (a+b*c);
}

=========================================
result.h
=========================================
int doit (int, int, int);

=========================================
tester1.cc
=========================================
#include <stdio.h>
#include <unistd.h>
#include <iostream.h>

#include "result.h"

int main (int argc, char *argv[])
{
    int result = doit (1, 2, 3);
    cout << "result = " << result << endl;
}

And then, the following makefile:
========================================
makefile
========================================

all : result.dll tester1

result.dll: result.cc
        g++ -g -o $@ -Wl,-shared $<

tester1 : result.dll tester1.cc
        g++ -g -o $@ $^

clean:
        rm result.dll tester1.exe


I have tried different and various flavours of things, and this
is what I have come up so far, that compiles.  However, it does
not run.  When I fire it up, it seems to go out to never-never
land, and i have to kill it with extreme prejudice.

(If I take out the empty main() in result.cc, then I get an unresolved
WinMain AT 16.  If I try to change the .dll in makefile to .so, then I get
a bunch of other errors during the final compile/link.

The above files, and the makefile work on a linux box, if I change
the .dll in the makefile to .so.)

Any help or light others would like to shed would be extremely
appreciated.....

Thanks.



--
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