1. Fresh Pair of Eyes

Hello all,

I was recently working on a wrapper for Tilengine. However, it seems that the library or DLL is not being loaded at all. I can't figure out why. The code itself is fine. The program runs, but is returning 0 and -1, thus the DLL is not being loaded. Maybe I'm overlooking something simple?

include std/ffi.e 
include std/machine.e 
include std/os.e 
include std/math.e 
 
public atom tile = 0 
 
ifdef WINDOWS then 
	tile = open_dll("Tilengine.dll") --This is how its spelled from the actual DLL  
	? tile --returns 0 
	elsifdef LINUX or FREEBSD then 
	tile = open_dll("libTilengine.so") 
end ifdef 
 
export constant xTLN_Init = define_c_func(tile,"+TLN_Init",{C_INT,C_INT,C_INT,C_INT,C_INT},C_INT) 
 
? xTLN_Init --returns -1 
 
public function TLN_Init(atom hres,atom vres,atom numlayers,atom numsprites,atom numani) 
	return c_func(xTLN_Init,{hres,vres,numlayers,numsprites,numani}) 
end function 
new topic     » topic index » view message » categorize

2. Re: Fresh Pair of Eyes

Download Dependencies (a modern clone of Dependency Walker). Open DependenciesGui.exe and drag Tilengine.dll into the main area.

It will show you the libraries it depends on and indicate which are missing. Let me know what you find and I can help more from there.

-Greg

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

3. Re: Fresh Pair of Eyes

ghaberek said...

Download Dependencies (a modern clone of Dependency Walker). Open DependenciesGui.exe and drag Tilengine.dll into the main area.

It will show you the libraries it depends on and indicate which are missing. Let me know what you find and I can help more from there.

-Greg

Ok I got it. It needed SDL2.dll. I added that to the project directory, but I'm still getting 0 and -1 for the return values. I'm using the 64-bit DLLs for both Tilengine and SDL2.

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

4. Re: Fresh Pair of Eyes

Icy_Viking said...

Ok I got it. It needed SDL2.dll. I added that to the project directory, but I'm still getting 0 and -1 for the return values. I'm using the 64-bit DLLs for both Tilengine and SDL2.

Does everything look correct in Dependencies after you added SDL2? You might have to close and reopen Dependencies for it to reload the libraries correctly. I always reopen it after making any changes.

-Greg

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

5. Re: Fresh Pair of Eyes

ghaberek said...
Icy_Viking said...

Ok I got it. It needed SDL2.dll. I added that to the project directory, but I'm still getting 0 and -1 for the return values. I'm using the 64-bit DLLs for both Tilengine and SDL2.

Does everything look correct in Dependencies after you added SDL2? You might have to close and reopen Dependencies for it to reload the libraries correctly. I always reopen it after making any changes.

-Greg

Yes. I looked through it and no errors come up and it says the DLL were loaded successfully. I've made a zip of my project so far. Maybe there is something I'm overlooking or some weird bug?

https://katfile.com/nl9g9d6tnpux/Tilengine.zip.html

OK, I think the DLL may not be loaded or opened using the open_dll() command.

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

6. Re: Fresh Pair of Eyes

Hi 2 hours and 26 minutes for 'slow speed' download! Use mediafire

Cheers

Chris

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

7. Re: Fresh Pair of Eyes

Icy_Viking said...

Yes. I looked through it and no errors come up and it says the DLL were loaded successfully. I've made a zip of my project so far. Maybe there is something I'm overlooking or some weird bug?

https://katfile.com/nl9g9d6tnpux/Tilengine.zip.html

OK, I think the DLL may not be loaded or opened using the open_dll() command.

Strange, it loads correctly for me. I downloaded my own copies of Tilengine.dll and SDL2.dll but the SHA256 hash matches for both files in your zip:

c2325ce01734ee1abe0f2a040d2ca8551012be3820a1fb2f32530d872df19517 SDL2.dll 
e4a3a5739512e78428e9062b63e8f9ac9da811c5c4b06b81bb94849804f77158 Tilengine.dll 

I put both of these files in C:\Euphoria\bin. Are you sure you're using 64-bit eui.exe when testing this?

You could try manually loading SDL2 first. This would help determine which library is actually causing the problem.

public atom sdl2 = 0 
public atom tile = 0 
 
ifdef WINDOWS then 
    sdl2 = open_dll("SDL2.dll") 
    tile = open_dll("Tilengine1.dll") 
elsifdef LINUX or FREEBSD then 
    sdl2 = open_dll("libSDL2-2.0.so.0") 
    tile = open_dll("libTilengine.so") 
end ifdef 
 
? sdl2 
? tile 
ChrisB said...

2 hours and 26 minutes for 'slow speed' download! Use mediafire

It's throttled to 100 KB/sec but the file is only ~900 KB so after jumping through the captcha it only takes a few seconds to download.

-Greg

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

8. Re: Fresh Pair of Eyes

ghaberek said...
Icy_Viking said...

Yes. I looked through it and no errors come up and it says the DLL were loaded successfully. I've made a zip of my project so far. Maybe there is something I'm overlooking or some weird bug?

https://katfile.com/nl9g9d6tnpux/Tilengine.zip.html

OK, I think the DLL may not be loaded or opened using the open_dll() command.

Strange, it loads correctly for me. I downloaded my own copies of Tilengine.dll and SDL2.dll but the SHA256 hash matches for both files in your zip:

c2325ce01734ee1abe0f2a040d2ca8551012be3820a1fb2f32530d872df19517 SDL2.dll 
e4a3a5739512e78428e9062b63e8f9ac9da811c5c4b06b81bb94849804f77158 Tilengine.dll 

I put both of these files in C:\Euphoria\bin. Are you sure you're using 64-bit eui.exe when testing this?

You could try manually loading SDL2 first. This would help determine which library is actually causing the problem.

public atom sdl2 = 0 
public atom tile = 0 
 
ifdef WINDOWS then 
    sdl2 = open_dll("SDL2.dll") 
    tile = open_dll("Tilengine1.dll") 
elsifdef LINUX or FREEBSD then 
    sdl2 = open_dll("libSDL2-2.0.so.0") 
    tile = open_dll("libTilengine.so") 
end ifdef 
 
? sdl2 
? tile 
ChrisB said...

2 hours and 26 minutes for 'slow speed' download! Use mediafire

It's throttled to 100 KB/sec but the file is only ~900 KB so after jumping through the captcha it only takes a few seconds to download.

-Greg

There's my problem. I was mixing the 64-bit DLLs with the 32-bit EUI. After I changed them to 32-bit DLLs, it works.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu