1. Problems with 4.1
- Posted by jessedavis Jul 23, 2018
- 1711 views
Laptop died. Replaced and loaded euphoria.
4.1.0 development (6300:57179171dbed, 2015-02-02 14:18:53) on HP machine running windows 10.
Two problems have been encountered running known good euphoria code.
1. Cannot open .dll files. Always returns NULL.
include jd/jd.e include std/dll.e atom sqlite3_dll = open_dll(`C:\Users\User\Downloads\sqlite-dll-win32-x86-3240000\sqlite3.dll`) printf(1,"return = %d\n",sqlite3_dll) ak()
2. Problem with include files. EUINC and PATH are set up correctly. Euphoria cannot find some of the included files. I noticed that the error message, which includes a list of the directories searched does NOT include all of the directories included in the PATH variable (user PATH not system PATH; however it doesn't seem to matter). My PATH includes 4 or 5 directories. It seems to search only the first couple. If I include the entire path in the include statement it works OK.
Found a copy of 4.05 and loaded. Problems went away.
Any thoughts or pointers?
Regards, jd
2. Re: Problems with 4.1
- Posted by SDPringle Jul 23, 2018
- 1638 views
I have noticed this problem as well. I noticed this kind of problem as well but on Linux on 4.0.6.
include std/dll.e -- Euphoria assert type truth_type(object x) return not equal(x,0) end type truth_type truth -- Returns zero on my machine. Weird eh? constant libc = open_dll("libc.so") -- Fails with a type error if libc is zero. truth = libc
Run this to quickly see that libc.so is not found on our machines. I tried it on both 4.1 and 4.0 (development) and neither of them find that file. On Linux there is always a library with libc.so. Over on Windows, you should always be able to open system.dll.
3. Re: Problems with 4.1
- Posted by SDPringle Jul 23, 2018
- 1606 views
I actually found I couldn't reproduce this with any dlls except for libc. It turns out that libc is a special case library and is in a format not like the others.
Perhaps you should try to load in kernel32.dll and get a handle for GetLastError. Then after trying to open this other library, use GetLastError to get an error code.
4. Re: Problems with 4.1
- Posted by irv Jul 24, 2018
- 1585 views
You can find libc.so on Linux with > locate libc.so
(Note: there is also a libc.a - which is not a shared library.)
On Mint, it's not in the standard location, but when I run open_dll with the actual location found above:
include std/dlle ? open_dll("/lib/x86_64-linux-gnu/libc.so.6")
It opens the dll.
-- full test: include std/dll.e include std/console.e include std/machine.e atom LIBC = open_dll("/lib/x86_64-linux-gnu/libc.so.6") atom cprintf = define_c_func(LIBC,"printf",{C_POINTER,C_POINTER},C_INT) atom txt = allocate_string("This is a test") atom fmt = allocate_string("-- %s --") integer len = c_func(cprintf,{fmt,txt}) display("\n\n[] characters printed",len)
irv@Mint18 ~ $ eui libctest -- This is a test -- 20 characters printed
5. Re: Problems with 4.1
- Posted by jmduro Jul 24, 2018
- 1552 views
1. Cannot open .dll files. Always returns NULL.
include jd/jd.e include std/dll.e atom sqlite3_dll = open_dll(`C:\Users\User\Downloads\sqlite-dll-win32-x86-3240000\sqlite3.dll`) printf(1,"return = %d\n",sqlite3_dll) ak()
The DLL path looks suspicious. Try this:
atom sqlite3_dll = open_dll("C:\\Users\\User\\Downloads\\sqlite-dll-win32-x86-3240000\\sqlite3.dll")
Regards,
Jean-Marc
6. Re: Problems with 4.1
- Posted by SDPringle Jul 24, 2018
- 1594 views
Good. I am using mint myself and maybe something I installed broke it in some way. In particular, there is a test in tests/t_dll.e which succeeds on my system where it tries to open libc.so.[1-8] and returns a positive number. Perhaps that's a good place for the user to start.
Hey original poster, go into tests and run
eutest t_dll.e
If the test succeeds, then there is something peculiar about this dll you are using. Perhaps it is the wrong architecture for your system.
7. Re: Problems with 4.1
- Posted by jessedavis Jul 26, 2018
- 1583 views
The DLL path looks suspicious. Try this:
atom sqlite3_dll = open_dll("C:\\Users\\User\\Downloads\\sqlite-dll-win32-x86-3240000\\sqlite3.dll")
Regards,
Jean-Marc
No difference between ` and ". Thx, jd
8. Re: Problems with 4.1
- Posted by jessedavis Jul 26, 2018
- 1456 views
More thoughts..
It will load kernel32.dll but only, I think, because it is already loaded. It will not load any other .dll from system32 I've tried. They can't all be bad.
REMEMBER this is only a problem with 4.1 if I go back to 4.0.5 everything works as it should.
I reloaded eu4.1 - no change
I ran eutest t_dll.e. It passed...
I need to work on this further. I am beginning to suspect a machine related problem.
Thanks & Regards,
jd
9. Re: Problems with 4.1
- Posted by jmduro Jul 26, 2018
- 1458 views
Thank you jd,
I was not aware this syntax was allowed. I tried both with a valid sqlite3 DLL and a verified path and it works!
include std/dll.e include std/console.e atom sqlite3_dll sqlite3_dll = open_dll("C:\\Users\\User\\Downloads\\sqlite3.dll") ? sqlite3_dll sqlite3_dll = open_dll(`C:\Users\User\Downloads\sqlite3.dll`) ? sqlite3_dll maybe_any_key()
1642070016 1642070016 Press Any Key to continue...
So either your DLL is corrupt or not adapted to your architecture (32-bit or 64-bit) or its path is not correct.
Jean-Marc
10. Re: Problems with 4.1
- Posted by petelomax Jul 26, 2018
- 1463 views
It will not load any other .dll from system32 I've tried. They can't all be bad.
REMEMBER this is only a problem with 4.1 if I go back to 4.0.5 everything works as it should.
Note that System32 contains 64-bit dlls; the 32-bit dlls are kept in sysWOW64 (though in theory that mapping should happen auto-magically for you).
All versions of 4.0.5 are 32-bit only.
Try running eui (4.1) without any arguments, see if it says "64-bit Windows"
If you download a copy of Phix and run demo\pGUI\filedump.exw (or demo\arwendemo\filedumpN.exw) you can open any dll or exe and immediately see (on the PE Header tab) whether machine (line 2) is i386 or amd64.
Pete