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]
Other format: [Raw text]

RE: Can I build a windows dll and lib from cygwin


There is a living and breathing example of building
a C DLL on the Cygwin site under "DLL STUFF" at
 http://www.neuro.gatech.edu/users/cwilson/cygutils/V1.1/dll-stuff/

I was able to kludge the example makefile in the "c" directory
(see below) with RSI's IDL C external calling example to give an
instance of IDL calling a *.c DLL using Cygwin GCC.

Obviously you should go through the Readme and so-on on the "DLL STUFF"
page; however, cutting right to the chase...
1. on Cygwin
 $ mkdir  /usr/src/dllhelpers-0.2.9
2. Back at the "DLL STUFF" page find "dllhelpers-0.2.9.tar.bz2"
(which is
http://www.neuro.gatech.edu/users/cwilson/cygutils/V1.1/dll-stuff/dllhelpers
-0.2.9.tar.bz2 )
and use Save As to put it into [~approx~C:\Cygwin]\usr\src\dllhelpers-0.2.9
3. on Cygwin
 $ cd /usr/src/dllhelpers-0.2.9
 $ bunzip2 dllhelpers-0.2.9.tar.bz2
 $ tar tvf dllhelpers-0.2.9.tar <----have a look first!!
 $ tar xvf dllhelpers-0.2.9.tar
 $ cd c
<begin real stuff...>
Administrator@LEAMAN /usr/src/dllhelpers-0.2.9/c
$ make
gcc -c  -I. -g -Wall  -o cdll.o cdll.c
gcc -shared -Wl,--out-implib=libcdll.dll.a \
-o cygcdll.dll cdll.o  -Wl,--export-all-symbols
Creating library file: libcdll.dll.a
gcc -c -I. -g -Wall  -o usedll.o usedll.c
gcc -o usedll.exe -g -Wall   usedll.o -L./ -lcdll
Warning: resolving _dll_global_int_var by linking to
__imp__dll_global_int_var (auto-import)

Administrator@LEAMAN /usr/src/dllhelpers-0.2.9/c
$ ./usedll
dll_int_square (3) = 9
dll_float_square (3.0) = 9.000000
dll_double_square (3.0) = 9.000000
Global integer variable: Should be 99
  directly                  : 99
.....
<end real stuff...>

Thanks, John


-----Original Message-----
From: MPP96SMW@sheffield.ac.uk [mailto:MPP96SMW@sheffield.ac.uk]
Sent: Friday, 18 January 2002 1:52 p.m.
To: cygwin@cygwin.com
Subject: Can I build a windows dll and lib from cygwin


As I am only just getting into cygwin, I would like to know if it is
possible to 
build a block of unix code (just console applications) and produce a dll
which 
can be called by windows applications.
I have done this following the advice on the cygwin sites and produce the 2 
files which i thought i needed these are foo.a (renamed to foo.lib below)
and 
foo.dll.
When I try to build a windows application linking to foo.a i get an error
saying 
the lib file can not be understood.
Have misunderstood the objective of the dll tool is it only to build apps on

cygwin?
I am using an application called matlab to build this file and get the
following 
echo returned

Microsoft (R) 32-Bit Incremental Linker Version 5.00.7022 
Copyright (C) Microsoft Corp 1992-1997. All rights reserved. 
 
vistaread_mex.obj foo.lib mexversion.res  
 
vistaread_mex.obj : error : Internal error during Pass1

Does this mean anything to anyone?
 
Mr. S. Wood,
Research assistant

Dept Medical Physics & Clinical Engineering
I floor
Royal Hallamshire Hospital
Glossop road,
Sheffield,
England.
S10 2JF

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


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