Usage of dll created in cygwin in VC++
Andrew Lipnitsky
ert@cit.org.by
Sun Jan 31 23:52:00 GMT 1999
ÃÂ
"S. Krishnaprasad" wrote:
ÃÂ I have
useddllwrap --export-all mdll.dll mylib.a -L. -lgmp I
get the DLL file.But when I try to use it in a Visual C++ application it
gives me a undefined reference to the functionnames defined in this DLL.I
created a export .DEF file which is as follows LIBRARY
<dllname>EXPORTS ÃÂ ÃÂ ÃÂ ÃÂ
function1ÃÂ ÃÂ ÃÂ function2 etc..Then
I created a import fileÃÂ .lib using dllwrap
--dllname <name.dll> --output-lib <libname.lib> This
created a .lib file
ÃÂ This when linked into a Visual
C++ application it compiles and links properly but whenI try to run this
application it just terminates at the function call.
Can
anybody help me.
Yes. In order to link dll you have to get library file. But you have to
use
LIB.exe program from VisualStudio like that
d:\DevStudio\VC\bin\LIB.EXE /DEF:foo.def
After that you will get foo.lib file.
>This when linked into a Visual
C++ application it compiles and links properly but when
>I try to run this application
it just terminates at the function call.
Due to program (as well dll) compiled with cygwin using cygwin1.dll
you can not link it with Visual C++ . In order to get ridÃÂ cygwin1.dll
you must compile your files with -mno-cygwin option, for example:
gcc -mno-cygwin -c foo.c -o foo.o
gcc -mno-cygwin -c dllinit.c -o dllinit.o
And you must create dll with --target option, for example
dllwrap --target i386-mingw32 -mno-cygwin --dllname foo.dll foo.o dllinit.o
After that you will get foo.dll file and so you can going to VC.
Note:
At first, youÃÂ must have something like dllinit.c file (see attachment).
At second, the algorithm described above is suitable only for C, not
for C++
language.
dllinit.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dllinit.c
Type: text/x-c
Size: 3007 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/19990131/478fa9cf/attachment.bin>
More information about the Cygwin
mailing list