This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]