1. Windows / Tdmgcc64 - unable to compile Euphoria shared library file


A simple code as oe_main.ex calling oe_funct() defined in oe_dll.e

This code well compiled

  • On Windows - euphoria-4.0.5-ow with watcom
  • On Linux - euphoria-4.0.5-Linux-ix86 with gcc
  • On Linux - euphoria-4.1.0-Linux-x86 with gcc
  • On Linux - euphoria-4.1.0-Linux-x64 with gcc (-extra-flags -no-pie)
  • On Linux - euphoria-4.2.0-Linux-x64 with gcc

gives :

- (OE) oe_main (.exe) : Calling oe_dll_funct() from oe_dll (.so/.dll) 
-     (OE) oe_dll (.so/.dll) : oe_dll_funct() says "Hello world !" 
- (OE) oe_main (.exe) : End 

But



This code compiled on Windows - euphoria-4.0.5

  • with gcc.exe (tdm64-1) 5.1.0
  • with gcc.exe (tdm64-1) 10.3.0
  • with gcc.exe (tdm32-1) 10.3.0
  • with i686-w64-mingw32-gcc.exe (Rev10, Built by MSYS2 project) 12.2.0

gives :

- Translating code, pass: 1 2 3  generating 
- Compiling with GCC / Linking 100% ..\out\oe_dll.dll 
- Translating code, pass: 1 2 3 4 5 6  generating 
- Compiling with GCC / Linking 100% ..\out\oe_main.exe 
- -?-> (OE) oe_main (.exe) : define_c_funct() returns -1 
- FAILURE 



This code compiled on Windows - euphoria-4.1.0-Windows-x86

  • with gcc.exe (tdm64-1) 5.1.0
  • with gcc.exe (tdm64-1) 10.3.0
  • with i686-w64-mingw32-gcc.exe (Rev10, Built by MSYS2 project) 12.2.0

gives :

- Translating code, pass: 1 2 3  generating 
- Compiling with GCC / Linking 100% ..\out\oe_dll.dll 
- Translating code, pass: 1 2 3 4 5 6  generating 
- Compiling with GCC / Linking 100% ..\out\oe_main.exe 
- ---> (OE) oe_main (.exe) : Calling oe_dll_funct() from oe_dll (.so/.dll) 
  -?-> oe_main ends prematurely, no ex.err is product. 
  ---> trace.out last line is : c_func(oe_dll_funct_rid, {}) 
- FAILURE 

  • and compiled with gcc.exe (tdm32-1) 10.3.0

gives :

- Translating code, pass: 1 2 3  generating 
- Compiling with GCC / Unable to link .\out\oe_dll.dll 
  -?-> C:/Euphoria/bin/eu.a(be_runtime.o):be_runtime.c: undefined reference to `__ms_vsnprintf' 
  -?-> C:/Euphoria/bin/eu.a(be_machine.o):be_machine.c: undefined reference to `__ms_vsnprintf' 
  -?-> C:/Euphoria/bin/eu.a(be_w.o):be_w.c: undefined reference to `__ms_vsnprintf' 
- Translating code, pass: 1 2 3 4 5 6 7 8 9  generating 
- Compiling with GCC / Unable to link .\out\oe_main.exe 
  -?-> C:/Euphoria/bin/eu.a(be_machine.o):be_machine.c: undefined reference to `__ms_vsnprintf' 
  -?-> C:/Euphoria/bin/eu.a(be_w.o):be_w.c: undefined reference to `__ms_vsnprintf' 
  -?-> C:/Euphoria/bin/eu.a(be_runtime.o):be_runtime.c: undefined reference to `__ms_vsnprintf' 
  -?-> C:/Euphoria/bin/eu.a(be_callc.o):be_callc.c: undefined reference to `__ms_vsnprintf' 
- FAILURE 



This code compiled on Windows - euphoria-4.1.0-Windows-x64

  • with gcc.exe (tdm64-1) 5.1.0
  • with gcc.exe (tdm64-1) 10.3.0
  • with x86_64-w64-mingw32-gcc.exe (Rev10, Built by MSYS2 project) 12.2.0

gives :

- Translating code, pass: 1 2 3  generating 
? User supplied library does not exist: C:\Euphoria\bin\euso.e 
- gcc -DEWINDOWS -fomit-frame-pointer -c -w -fsigned-char -O2 -m64 -IC:/Euphoria -ffast-math oe_dll.c -o oe_dll.o 
? oe_dll.c: error: 'oe_dll_funct' aliased to undefined symbol '_1oe_dll_funct@0' 
? void oe_dll_funct() __attribute__ ((alias ("_1oe_dll_funct@0"))); 
- Translating code, pass: 1 2 3 4 5 6 7 8 9  generating 
- Compiling with GCC / Linking 100% ..\out\oe_main.exe 
- ---> (OE) oe_main (.exe) : open_dll() returns 0 (expected) 
- FAILURE 



Systems :

  • - Linux x86_64 - 4.15.0-204-generic - Ubuntu - Mint 19.1
  • - Windows_10 x86_64 - version 10.0.19044.2486


Question : Is there a way to compile Euphoria 4.1.0 shared library files on Windows ?

Regards, Philippe

new topic     » topic index » view message » categorize

2. Re: Windows / Tdmgcc64 - unable to compile Euphoria shared library file

kelen_ said...

Question : Is there a way to compile Euphoria 4.1.0 shared library files on Windows ?

Sorry, all of your markup is making this hard to follow. If you could just put the output messages directly into {{{/}}} blocks without any additional markup, that would help.

Also, know that building shared libraries from Euphoria code is not well-tested so I'm not sure how much I can help. There are a few things to focus on here:

User supplied library does not exist: C:\Euphoria\bin\euso.e 

The eu.a and euso.a libraries are for building static and dynamic binaries, respectively. Basically euso.a is built with -fPIC (position-independent code) and eu.a is not. But on Windows it's all the same, so you can just copy eu.a to euso.a to correct this.

oe_dll.c: error: 'oe_dll_funct' aliased to undefined symbol '_1oe_dll_funct@0' 
void oe_dll_funct() __attribute__ ((alias ("_1oe_dll_funct@0"))); 

The translator is erroneously attaching 32-bit STDCALL name-decoration to the exported functions, but since you're doing this with 64-bit the "@0" bits at the end are causing a problem. You can remove them from the generated C code and it should build correctly.

-Greg

new topic     » goto parent     » topic index » view message » categorize

3. Re: Windows / Tdmgcc64 - unable to compile Euphoria shared library file

Hi Greg,

I’m sorry for my novice use of your "creole" formatted interface.

You are right about the removal of the function’s 32-bit name-decoration but it goes back to the problem encountered when running the 32-bit compiled program which shows that the dll call is broken.

On this point I found a path that seems to give satisfaction by replacing the function "LibMain" by "DllMain" within the file "main-. c" generated during the translation of "oe_dll. e". This seems sufficient to repair the situation but nevertheless does not presume any side effects.

The code for "compile. e" uses the "LibMain" function near line 7257 which appears to be obsolete and which seems to need to be replaced by the "DllMain" function.

The question of the library "C: Euphoria bin euso. e" does not seem to come into play.

With courtesy,
Philippe

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu