vonc Posted May 24, 2005 Share Posted May 24, 2005 Hi,I compile with g++ (cygwin gcc-3.3.3-3 WindowsXPSP1) a simple dll, with a source similar to this thread: layer's first dllHowever, when I try to DllCall it or to DllLoad it, Autoit just freeze (I must CTRL+Break it). It never returns. (with autoit 3.1.1 latest beta 37, 38...)If I make a test C program, which try to "LoadLibrary", it works...The shared dll produced does contain a DllMain.I tried various compilation options. (see below for an example of a compilation log)Have you any clue about the correct option to produce a dll loadable with AutoIt ?Or is gcc cygwin a non-compatible option to produce Autoit loadable dll ?Thanks in advance.VonC------- COMPILATION LOG SAMPLE -----------**** Incremental build of configuration Custom for project Sample ****make -k all Building file: ../Sample.cppg++ -O0 -Wall -c -fmessage-length=0 -v -oSample.o ../Sample.cppReading specs from /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/specsConfigured with: /gcc/gcc-3.3.3-3/configure --verbose --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --enable-languages=c,ada,c++,d,f77,java,objc,pascal --enable-nls --without-included-gettext --enable-libgcj --with-system-zlib --enable-interpreter --enable-threads=posix --enable-java-gc=boehm --enable-sjlj-exceptions --disable-version-specific-runtime-libs --disable-win32-registryThread model: posixgcc version 3.3.3 (cygwin special) /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/cc1plus.exe -quiet -v -D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=3 -D__CYGWIN32__ -D__CYGWIN__ -Dunix -D__unix__ -D__unix -idirafter /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/../../../../include/w32api -idirafter /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/../../../../i686-pc-cygwin/lib/../../include/w32api ../Sample.cpp -D__GNUG__=3 -quiet -dumpbase Sample.cpp -auxbase-strip Sample.o -O0 -Wall -version -fmessage-length=0 -o /cygdrive/c/temp/ccNcEYz6.sGNU C++ version 3.3.3 (cygwin special) (i686-pc-cygwin) compiled by GNU C version 3.3.3 (cygwin special).GGC heuristics: --param ggc-min-expand=56 --param ggc-min-heapsize=49086ignoring nonexistent directory "/usr/local/include"ignoring nonexistent directory "/usr/i686-pc-cygwin/include"ignoring duplicate directory "/usr/i686-pc-cygwin/lib/../../include/w32api"#include "..." search starts here:#include <...> search starts here: /usr/include/c++/3.3.3 /usr/include/c++/3.3.3/i686-pc-cygwin /usr/include/c++/3.3.3/backward /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/include /usr/include /usr/include/w32apiEnd of search list. /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/../../../../i686-pc-cygwin/bin/as.exe --traditional-format -oSample.o /cygdrive/c/temp/ccNcEYz6.sReading specs from /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/specsConfigured with: /gcc/gcc-3.3.3-3/configure --verbose --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --enable-languages=c,ada,c++,d,f77,java,objc,pascal --enable-nls --without-included-gettext --enable-libgcj --with-system-zlib --enable-interpreter --enable-threads=posix --enable-java-gc=boehm --enable-sjlj-exceptions --disable-version-specific-runtime-libs --disable-win32-registryThread model: posixgcc version 3.3.3 (cygwin special) /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/cc1plus.exe -E -D__GNUG__=3 -quiet -v -P -MM -MG -D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=3 -D__CYGWIN32__ -D__CYGWIN__ -Dunix -D__unix__ -D__unix -idirafter /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/../../../../include/w32api -idirafter /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/../../../../i686-pc-cygwin/lib/../../include/w32api ../Sample.cpp -Wall -w -fmessage-length=0 -O0ignoring nonexistent directory "/usr/local/include"ignoring nonexistent directory "/usr/i686-pc-cygwin/include"ignoring duplicate directory "/usr/i686-pc-cygwin/lib/../../include/w32api"#include "..." search starts here:#include <...> search starts here: /usr/include/c++/3.3.3 /usr/include/c++/3.3.3/i686-pc-cygwin /usr/include/c++/3.3.3/backward /usr/lib/gcc-lib/i686-pc-cygwin/3.3.3/include /usr/include /usr/include/w32apiEnd of search list.Finished building: ../Sample.cpp Building target: Sample.dllg++ -shared -o Sample.dll Sample.o Finished building: Sample.dllBuild complete for project Sample -- VonCMinefield Link to comment Share on other sites More sharing options...
vonc Posted May 24, 2005 Author Share Posted May 24, 2005 Up, Up To sumarize my problem exposed in the previous post:Do you have an example of a gcc commande-line able to compile a C source file into a Dll ?(a Dll that you can then 'DllCall' or 'DllOpen' in an Autoit script)Again, My gcc command-line does produce a Dll, but the Autoit script freezes when it 'DllCall' or 'DllOpen' it -- VonCMinefield Link to comment Share on other sites More sharing options...
vonc Posted May 25, 2005 Author Share Posted May 25, 2005 Up again, Ok, let me rephrase the question:Anyone with a valid gcc command-line to produce a dll that can be called within an Autoit script ?Rq: the only compiler I have access to is a gcc one, the gcc with cygwin...Thanks in advance. -- VonCMinefield Link to comment Share on other sites More sharing options...
SumTingWong Posted May 25, 2005 Share Posted May 25, 2005 Up again, Ok, let me rephrase the question:Rq: the only compiler I have access to is a gcc one, the gcc with cygwin...Thanks in advance.<{POST_SNAPBACK}>Why don't you upload your dll and the script you are using to access this dll and people might be a bit more responsive. Link to comment Share on other sites More sharing options...
Ejoc Posted May 25, 2005 Share Posted May 25, 2005 I use this to compile a DLL: gcc -c MyDll.c gcc -shared -o MyDll.dll MyDll.o -Wl,--out-implib,libmessage.a MyDll.c: #define EXPORT __declspec(dllexport) EXPORT int ReturnInt(int src) { return src; } AutoIt: $ret = DllCall("MyDll.dll","int","ReturnInt","int",5) MsgBox(0,"Should be 5",$ret[0]) Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs Link to comment Share on other sites More sharing options...
vonc Posted May 26, 2005 Author Share Posted May 26, 2005 I use this to compile a DLL:gcc -c MyDll.c gcc -shared -o MyDll.dll MyDll.o -Wl,--out-implib,libmessage.aHi Ejoc, And thanks for this answer. I tried exactly your Dll.c and the two gcc line, creating a MyDll.dll (and a libmessage.a ?) The result of a DllCall (or DllOpen) remains the same: freeze... I suppose my cygwin gcc is somehow incorrect...C:\>which gcc/usr/bin/gccC:\>gcc --versiongcc (GCC) 3.3.3 (cygwin special) -- VonCMinefield Link to comment Share on other sites More sharing options...
Ejoc Posted May 26, 2005 Share Posted May 26, 2005 Can you at least show the AutoIt lines you are using to call the functions or are you using all 3 examples I posted? Otherwise I guess it's your compiler, I use either MingGW by it's self or I use Dev-C++ when I work on AutoIt source. Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs Link to comment Share on other sites More sharing options...
vonc Posted May 27, 2005 Author Share Posted May 27, 2005 Can you at least show the AutoIt lines you are using to call the functions or are you using all 3 examples I posted? Otherwise I guess it's your compiler, I use either MingGW by it's self or I use Dev-C++ when I work on AutoIt source.<{POST_SNAPBACK}>Well... the Autoit line is precisely the one you use in your example.$ret = DllCall("MyDll.dll","int","ReturnInt","int",5)MsgBox(0,"Should be 5",$ret[0])The MsgBox never displays, because the Autoit script freezes in the DllCall Step.I will try with a standalone installation of MingGW instead of a gcc included in a cygwin distributionAnyway, thank you for your inputs and advices -- VonCMinefield Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now