public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* [Fwd: A newbie who is stuck with creating a DLL]
@ 1999-09-24 18:51 Eric Feliu
  1999-09-30 23:42 ` Eric Feliu
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Feliu @ 1999-09-24 18:51 UTC (permalink / raw)
  To: cygwin; +Cc: Mumit Khan

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Fwd: A newbie who is stuck with creating a DLL]
  1999-09-24 18:51 [Fwd: A newbie who is stuck with creating a DLL] Eric Feliu
@ 1999-09-30 23:42 ` Eric Feliu
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Feliu @ 1999-09-30 23:42 UTC (permalink / raw)
  To: cygwin; +Cc: Mumit Khan

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1999-09-30 23:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-09-24 18:51 [Fwd: A newbie who is stuck with creating a DLL] Eric Feliu
1999-09-30 23:42 ` Eric Feliu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).