This is the mail archive of the cygwin@sourceware.cygnus.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]

[Fwd: A newbie who is stuck with creating a DLL]


Hello all,

    I was able to create my dll library successfully and thought I would

share with everyone what I did to get my code to work.  I am by no
means an expert in this stuff, so if I state an inaccuracy here it is
not
intentional, I just thought I would share my newbie experience with
the rest of my ilk.

    Anyway my problem was basically this: I had some old C code (circa
1991)
that was written for Sco Unix 3.2 that I was so fortunate to inherit,
this code
was not written with portability in mind and had little to no comments
to aid
in deciphering. Since I did not write this code I decided that
translating this code
to Java would take too long (probably a month). I didn't need all of the
code either
since alot of the functionality from the Unix GUI would be taken over by
an application
called Arcview (COTS mapping software ), I just needed the C code that
did alot of
intense math. When I  learned that Arcview could load DLL's to extend
it's functionality
I remembered reading the cygwin documentation about how to build DLL's
with gcc. At
first I thought this would be relatively straight forward, maybe for a
windows programmer
it is, but I have been programming in the Unix environment for the last
three years and found
myself hopelessly stuck with the instructions in the cygwin
documentation. The
problem with the instructions provided in the cygwin documentation (for
me anyway)
was that it was specific to building DLL's that would be called from a
Cygwin C program,
I guess I mean more specifically a program that would rely on the Cygwin
runtime
libraries as opposed to the windows native libraries like kernel32.dll
Also, after browsing
through the mailing list archives I came upon references to "creating
DLL's that can be called
from excel and other windows programs", and I found example C source
code and a Makefile
that was very informative. The only other piece that was missing from
that was a ld option for
the entry point of the DLL, I found this in an example of a Java Native
Interface call to a dll, the
Makefile for that example had this option
"-M1,-e,_cygwin_nocygwin_init@12" that was part
of the DLL_LDOPTIONs macro. After adding that to my Makefile my dll
worked like a champ.

    Hopefully someone else might find this info useful, but if your a
newbie like me you will probably
have to search the mailing list to find an answer close to your specific
problem.
I will say this, the time I spent figuring out how to create a windows
DLL through Cygwin is
nothing compared to what I would of had to do without it. My many thanks
to the persons
responsible for this great product. It's great running BASH on a NT
workstation, it makes a Unix
programmer feel more at home.


Eric



On Thu, 23 Sep 1999, Eric Feliu wrote:

>     Thanks for your advice, I was able to get my DLL to work after I searched
> through
> the mailing lists very extensivley. A piece of info here and there and I
> finally got it to work.
> Again thanks for the advice and patience.

Eric,

Glad it worked out!

Perhaps you could summarize the problems you've had and how you tracked
down the solutions and post it to the list? It may help the next `n' users 
who will inevitably run into the same problem.

Regards,
Mumit






--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

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