Re: Eu->dll on Windows, can't get it to work

new topic     » goto parent     » topic index » view thread      » older message » newer message

I am also using 4.1 Beta 2. I did some debugging and it looks like it has to do with heap allocation. See the segfault at the end of the debugging output below.

I would try going back to Beta 1 or build from source and see if it's still a problem. I couldn't find any open tickets about this so we may have found a bug.

-- dll_test.e 
 
public function add_two( atom value ) 
    return (value + 2) 
end function 
  
public procedure print_hex( atom value ) 
    printf( 1, "#%08x\n", value ) 
end procedure 
-- test_dll.ex 
include std/dll.e 
include std/machine.e 
 
atom dll_test = open_dll( "dll_test.dll" ) 
printf( 2, "dll_test = #%08x\n", dll_test ) 
 
constant add_two = define_c_func( dll_test, "+add_two", {E_ATOM}, E_ATOM ) 
printf( 2, "add_two = %d\n", add_two ) 
 
constant print_hex = define_c_proc( dll_test, "+print_hex", {E_ATOM} ) 
printf( 2, "print_hex = %d\n", print_hex ) 
 
atom value = rand( 100 ) 
printf( 2, "value = %d\n", value ) 
 
value = c_func( add_two, {value} ) 
printf( 2, "add_two( value ) = %d\n", value ) 
 
puts( 2, "print_hex( value ) = " ) 
c_proc( print_hex, {value} ) 

>euc -dll dll_test.e 
Build directory: build-715921\ 
Translating code, pass: 1 2 3  generating 
Compiling with GCC 
Compiling  13% init-.c 
Compiling  50% dll_test.c 
Compiling  75% main-.c 
Linking 100% ..\dll_test.dll 

>gdb32 eui 
GNU gdb (GDB) 7.9.1 
Copyright (C) 2015 Free Software Foundation, Inc. 
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> 
This is free software: you are free to change and redistribute it. 
There is NO WARRANTY, to the extent permitted by law.  Type "show copying" 
and "show warranty" for details. 
This GDB was configured as "mingw32". 
Type "show configuration" for configuration details. 
For bug reporting instructions, please see: 
<http://www.gnu.org/software/gdb/bugs/>. 
Find the GDB manual and other documentation resources online at: 
<http://www.gnu.org/software/gdb/documentation/>. 
For help, type "help". 
Type "apropos word" to search for commands related to "word"... 
Reading symbols from eui...done. 
(gdb) run test_dll.ex 
Starting program: C:\Euphoria\bin\eui.exe test_dll.ex 
[New Thread 15932.0x1bc4] 
[New Thread 15932.0x2ac0] 
[New Thread 15932.0x2fd4] 
[New Thread 15932.0x114c] 
dll_test = #71180000 
value = 87 
 
Program received signal SIGSEGV, Segmentation fault. 
0x00000001 in ?? () 
(gdb) bt 
#0  0x00000001 in ?? () 
#1  0x0000001c in ?? () 
#2  0x8014cc8c in ?? () 
#3  0x76ecdecb in ntdll!RtlAllocateHeap () from C:\Windows\SYSTEM32\ntdll.dll 
Backtrace stopped: previous frame inner to this frame (corrupt stack?) 

-Greg

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu