1. Phix DLL dependency issue

Hi Pete,

I have a full IUP installation on my machine (I use it with other languages) and I updated to IUP 3.25 / CD 5.11.1 last week.
To my great surprise Phix then stopped being able to run any PGui programs. The error reported was that it was unable to load iupcontrols.dll.

A bit of digging showed that iupcontrols was fine but it seems to have an internal dependency on something in another iup-related dll and was missing a particular function. (I haven't looked at the interdependencies in detail yet)

By replacing all the iup dlls in PGui\win32 with the ones from my installation, everything works again.
It looks like Windies is loading my system32 dlls for dependencies because that's close to the front of the library search order.
Incidentally, this also fixes my problem with simple_paint which now also runs fine.

What I would like is for Phix to use my existing IUP installation and deal with binding errors myself.
I will have a look at doing this (in a sanitary way if such a thing is possible).

As far as I can tell, the only easy way to get stuff loaded ahead of system32 is to put it in the directory the exe is in.

Les

new topic     » topic index » view message » categorize

2. Re: Phix DLL dependency issue

lesterb said...

By replacing all the iup dlls in PGui\win32 with the ones from my installation, everything works again.

What I would like is for Phix to use my existing IUP installation and deal with binding errors myself.
I will have a look at doing this (in a sanitary way if such a thing is possible).

Hmm, I seem to have faffed about a bit there. In pGUI.e/iup_open_dll I see:

        if chdir(dll_path)=0 then ?9/0 end if 
        path = current_dir()&SLASH&path 

and I suspect that second line is at least a bit bogus, and should perhaps just be removed.

And in iup_init1(),

    if s!={} then 
if platform()=WINDOWS then  -- DEV (while manually installed on lnx) 
        printf(1,"unable to locate %s directory\n",dll_dir) 
        {} = wait_key() 
        ?9/0 
end if 
    end if 

is probably a bit over-zealous/pre-emptive. Perhaps where that code currently is might be better as

dll_path = "" 

and avoid any subsequent attempts to chdir(""), eg/ie replace that line above with

if dll_path!="" and chdir(dll_path)=0 then ?9/0 end if 

and only issue an error if/after we couldn't open the dll.

Oh, I nearly forgot, I was going to say, "what happens if you just delete/rename the demo\pGUI\win32 directory?", however a
quick look at the code suggested that would not end well - when of course it should [as in when this is properly fixed] be fine.

Pete

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

3. Re: Phix DLL dependency issue

Hi Pete

Thanks for the changes. After making them and one extra change to iup_init1() it worked fine (with win32 empty).
Following a bit of rationalisation (sorry, can't help myself) open_dll() ended up looking like this...

function iup_open_dll(sequence libs) 
string path = libs[libidx] 
 
    if platform()=WINDOWS then 
        if dll_path != "" and chdir(dll_path)=0 then ?9/0 end if 
    elsif platform()=LINUX then 
--      for now, see demo/pGUI/lnx/installation.txt... 
--      path = dll_path&path 
    end if 
 
    atom res = open_dll(path) 
    if res=0 then iup_link_error(path) end if 
    return res 
end function 

The start of iup_init1() ends up like this (without comment blocks and bindings) ...

procedure iup_init1(nullable_string dll_root) 
    sequence s = include_paths() 
    string dll_dir = sprintf("%s%d",{dirs[libidx],machine_bits()}) 
    for i=1 to length(s) do 
        sequence sip = split_path(s[i]) 
        if sip[$]="pGUI" then 
            sip = append(sip,dll_dir) 
            dll_path = join_path(sip,trailsep:=1) 
 
            if get_file_type(dll_path)=FILETYPE_DIRECTORY then 
                s = {} 
                exit 
            end if 
        end if 
    end for 
    if s!={} then 
        -- allow pGUI in the app dir, with a win/lnx,32/64 sub-dir: 
        for i=1 to length(s) do 
            string dll_path = join_path({s[i],dll_dir}) 
            if get_file_type(dll_path)=FILETYPE_DIRECTORY then 
                s = {} 
                exit 
            end if 
        end for 
    end if 
    if s!={} then 
        string dll_path = join_path({dll_root,dll_dir}) 
        if get_file_type(dll_path)=FILETYPE_DIRECTORY then 
            s = {} 
        end if 
    end if 
 
-- LES: Code changed here 
    dll_path = "" 
 
--DEV: 
    if platform()=WINDOWS then 
        string curr_dir = current_dir() 
 
-- LES: I added the first test in next line 
        if dll_path != "" and chdir(dll_path)=0 then ?9/0 end if 
         
        if open_dll("msvcr120.dll")=0 then 
            puts(1,"fatal error: msvcr120.dll could not be loaded\n") 
            puts(1," try installing Visual C++ Redistributable Packages for Visual Studio 2013\n") 
            puts(1," from https://www.microsoft.com/en-us/download/details.aspx?id=40784 \n") 
            -- ( https://www.microsoft.com/en-us/download/details.aspx?id=40784 ) 
            {} = wait_key() 
            ?9/0 
        end if 
        if chdir(curr_dir)=0 then ?9/0 end if 
    end if 

Les

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

4. Re: Phix DLL dependency issue

lesterb said...

The start of iup_init1() ends up like this

-- LES: Code changed here 
    dll_path = "" 

Sorry, not that it concerns the case you are testing, but just for info, I meant this:

-- LES: Code changed here 
    if s!={} then 
        dll_path = "" 
    end if 

And I have kept the save & restore of curr_dir in iup_open_dll() [which also does not affect you].

In any case, I have also made those changes here, they seem to be fine on my setup, and will be in the next release, whenever that is.

Thanks, Pete

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

5. Re: Phix DLL dependency issue

Ok, thanks.

Incidentally, I had a look at the Rosetta animate_pendulum2.exw 'resizing madness' problem and I have a fix. However, there's another problem with it (which affects the Arwen version too) that I don't have a fix for yet. More to come.

Is it Ok to post "Phix example stuff" like that here?

Les

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

6. Re: Phix DLL dependency issue

lesterb said...

Ok, thanks.

Incidentally, I had a look at the Rosetta animate_pendulum2.exw 'resizing madness' problem and I have a fix. However, there's another problem with it (which affects the Arwen version too) that I don't have a fix for yet. More to come.

Is it Ok to post "Phix example stuff" like that here?

Les

Any Euphoria related content is welcome: Eu, OE, and Phix.

_tom

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

7. Re: Phix DLL dependency issue

lesterb said...

Is it Ok to post "Phix example stuff" like that here?

Yeah, of course - please and thank you too.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu