progress(kind of) working on dll cygwin gcc tcl swig

marvin cita140volunteer@yahoo.com
Tue Oct 21 20:22:00 GMT 2003


hi-
 
i spent some more effort working on getting this dll
to work.  here is what i tried.
 
$ c++ -o cyg /aab/fox.cpp
In file included from /aab/fox.cpp:1:
/aab/fox.h:1:36: warning: no newline at end of file
/aab/fox.cpp:13:2: warning: no newline at end of file
owner@BEDROOM /
$ c++ -c /aab/fox.cpp
In file included from /aab/fox.cpp:1:
/aab/fox.h:1:36: warning: no newline at end of file
/aab/fox.cpp:13:2: warning: no newline at end of file
owner@BEDROOM /
$ c++ -shared ./fox.o /cygwin/lib/mingw/libstdc++.a -o
module.dll
 
I copied the module.dll file into c:\program
files\tcl\bin with explorer.
I then tried to load the module.dll using the Tclsh84
console.
 
 
% catch {load ./module.dll module}
1
%

That one error above means i need go know further. 
oops... forgot the swig part.
i'll try and tackle that below.
 
I tried to keep the C++ code basic.
 
/*source file*/
#include "fox.h"
int main()
{
   addnum(2,3);
 return 0;
}
int addnum(int x,int y)
{
 return x+y;
}
 
/* header file*/
extern "C" int addnum(int x,int y);
 
my goal is to be able to use addnum function in
Tclsh84 console but i am falling short.  
 
has any one converted these unix prompt commands into
bash console commands??
can i see an example??  i saw example_wrap.cxx get
automatically generated with vc++ 6.  i dont know how
this would happen with cygwin.  i probably need to
change the header file to a resource file with an .i
ending like the tutorial at
http://www.swig.org/tutorial.html  .  lets see it is
calling swig so i need to add to the path statement to
point to the swig.exe maybe and same with the tclsh
unix command (now a bash console command).
 
i will work on this tonight after the world series.  i
need some rest.
 
 unix % swig -tcl example.i
unix % gcc -fpic -c example.c example_wrap.c \
        -I/usr/local/include 
unix % gcc -shared example.o example_wrap.o -o
example.so
unix % tclsh

please let me know if this makes sense to you.  does
it stand a chance of working?
thanks--marvin
 
this quote might get me but i have other things to try
first.
 
"Note that if you build your DLL as a Cygwin-linked
DLL, you should really
load it from a Cygwin-linked Tcl/Tk shell as well to
avoid certain
problems. If you're using Cygwin b20.x, it already
comes with tclsh/wish
etc, and it's a non-issue then."







__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list