Problems creating dll / preprocessor
- Posted by andi49 Aug 20, 2014
- 2133 views
Hallo
I started using the Euphoria Preprocessor feature. To get more specific i like to use the Jeremy Cowgar's dot4 preprocessor (it can be found here https://bitbucket.org/jcowgar/dot4/ )
The Preprocessor as a script-file (dot.ex) seems to work with Eu4.0.x and Eu4.1 (32bit and 64bit ).
I also can translate and compile it to dot.exe with all Versions of Euphoria I use.
What i can't do is, building a working dll of the preprocessor, they all fail for different reasons.
Okay, this is what i use:
Operatingsystem Win8 64bit.
C:\eu4neu\jcowgar-dot4-466834760c1b\src>ver Microsoft Windows [Version 6.3.9600]
64bit Deevelopment:
C:\eu4neu\jcowgar-dot4-466834760c1b\src>c:\eu4.1-64\bin\euc Euphoria to C Translator v4.1.0 development 64-bit Windows, Using System Memory Revision Date: 2014-03-03 19:34:37, Id: 6199:59b3bcba649a ERROR: Must specify the file to be translated on the command line
C:\eu4neu\jcowgar-dot4-466834760c1b\src>gcc --version gcc (tdm64-1) 4.7.1 Copyright (C) 2012 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
The 64bit Version generates a dll. The dll can be loaded, but linking the c_func fails.
32bit Development:
C:\eu4neu\jcowgar-dot4-466834760c1b\src>gcc --version gcc (tdm-1) 4.7.1 Copyright (C) 2012 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
C:\eu4neu\jcowgar-dot4-466834760c1b\src>c:\eu4.1-32\bin\euc Euphoria to C Translator v4.1.0 development 32-bit Windows, Using System Memory Revision Date: 2014-03-03 19:34:37, Id: 6199:59b3bcba649a ERROR: Must specify the file to be translated on the command line
C:\eu4neu\jcowgar-dot4-466834760c1b\src>c:\eu4.0-32\bin\euc Euphoria to C Translator v4.0.5 development Windows, Using System Memory Revision Date: 2014-06-09 15:57:20, Id: 6227:9cca399cbb74 ERROR: Must specify the file to be translated on the command line
The 32Bit Eu4.1 Version gives this Error Message:
C:\eu4neu\jcowgar-dot4-466834760c1b\src>c:\eu4.1-32\bin\euc -dll dot_dll.ex Build directory: build-232385\ Translating code, pass: 1 2 3 4 5 6 7 8 9 10 11 generating Compiling with GCC Compiling 2% init-.c Compiling 11% dot_dll.c Compiling 17% main-.c Compiling 22% dot_pp.c dot_pp.c:2761:8: error: conflicting types for '_2dot' In file included from dot_pp.c:3:0: main-.h:951:18: note: previous declaration of '_2dot' was here Couldn't compile file 'dot_pp.c' Status: 1 Command: gcc -DEWINDOWS -fomit-frame-pointer -c -w -fsigned-char -O2 -m32 -Ic:/EU4~2.1-3 -ffast-math dot_pp.c
dot_pp.c:2761 object _2dot(object _inFileName_11917, object _outFileName_11918, object _verbose_11919) main-.h:951 object __stdcall _2dot(object, object, object);
The 32bit 4.0 Version generates a dll. The dll can be loaded, but linking the c_func fails.
PE Explorer shows that the function is exported:
// _1preprocess@12; Index 535; Information not available
If i use this mangeld name i can succesfully link the function.
I use this little program for testing.
include std/dll.e include std/machine.e include std/os.e include std/console.e ifdef BITS64 then constant tinlib= open_dll("dot_dll64.dll") elsedef constant tinlib= open_dll("dot_dll.dll") end ifdef if tinlib then puts(1,"DLL linked ..."&"\n") else puts(1,"DLL linking failed ..."&"\n") -- abort(1) end if constant preproc=define_c_func(tinlib,"_1preprocess@12",{E_SEQUENCE,E_SEQUENCE,E_SEQUENCE},E_INTEGER) -- constant preproc=define_c_func(tinlib,"preprocess",{E_SEQUENCE,E_SEQUENCE,E_SEQUENCE},E_INTEGER) if preproc>0 then puts(1,"Function linked ..."&"\n") else puts(1,"Function preprocess linking failed ..."&"\n") -- abort(1) end if any_key()
Maybe someone knows what I'am are doing wrong. btw. All Versions of Euphoria i use are build with the above shown Compiler. I regulary use the translator but didn't used it for creating dll's for a longer time.
Andreas