[Iup-users] using IUP via dynamic linking

2020-07-21 Thread Mark

I am trying to create some Rust bindings to IUP using dynamic linking.
This works fine for iup.{so,dll}.

However, it fails to work for iupim.{so,dll}.

I have a prototype in Python and that had the same problem. However, in 
Python I could solve the problem like this:


DLL_ROOT = (pathlib.Path(__file__).parent / 'iup').resolve()
# Windows & error checking code omitted
DLL_ROOT /= 'linux'
iup_dll = DLL_ROOT / 'libiup.so'
iup = ctypes.cdll.LoadLibrary(iup_dll) # Equivalent to Rust's 
libloading::Library::new()


The above works. But continuing, this fails:
im_dll = DLL_ROOT / 'libiupim.so'
im = ctypes.cdll.LoadLibrary(im_dll)

However, I can get IM to load by doing this instead:
im_dll = 'iupim' # only the bare name needed in this case
im = ctypes.CDLL(im_dll, handle=iup)

This works because the `handle` refers to the original loaded `iup` 
library.


Unfortunately, I don't know how to do the equivalent in Rust. (I've 
asked on the Rust forum.)


But I just wondered if other people had had problems with dynamic 
loading and if there was another way to do it? Or if anyone has an 
example in C or C++ or Rust that loads both IUP and IM?



___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] using IUP via dynamic linking

2020-07-21 Thread Ranier Vilela
De: Mark 
Enviado: terça-feira, 21 de julho de 2020 15:40
Para: iup-users@lists.sourceforge.net
Assunto: [Iup-users] using IUP via dynamic linking

>The above works. But continuing, this fails:
>im_dll = DLL_ROOT / 'libiupim.so'
>im = ctypes.cdll.LoadLibrary(im_dll)
At windows side, is libim.dll
Are you sure, about libiupim.so name?

regards,
Ranier Vilela

___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] using IUP via dynamic linking

2020-07-21 Thread Antonio Scuri
  I didn't read all the details, but you can try to load IM and IUP before
loading IUPIM.

Best,
Scuri


Em ter., 21 de jul. de 2020 às 16:11, Ranier Vilela 
escreveu:

> De: Mark 
> Enviado: terça-feira, 21 de julho de 2020 15:40
> Para: iup-users@lists.sourceforge.net
> Assunto: [Iup-users] using IUP via dynamic linking
>
> >The above works. But continuing, this fails:
> >im_dll = DLL_ROOT / 'libiupim.so'
> >im = ctypes.cdll.LoadLibrary(im_dll)
> At windows side, is libim.dll
> Are you sure, about libiupim.so name?
>
> regards,
> Ranier Vilela
>
> ___
> Iup-users mailing list
> Iup-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/iup-users
>
___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users


Re: [Iup-users] using IUP via dynamic linking

2020-07-28 Thread Matthew Kennedy
On Tue, Jul 21, 2020, at 10:40 AM, Mark wrote:
> I am trying to create some Rust bindings to IUP using dynamic linking.
> This works fine for iup.{so,dll}.

> But I just wondered if other people had had problems with dynamic 
> loading and if there was another way to do it? Or if anyone has an 
> example in C or C++ or Rust that loads both IUP and IM?

Hi Mark, I make extensive use of runtime dynamic linking via LoadLibrary etc. 
for the Common Lisp bindings I work on. I've not had run into any problems 
inherent to IUP's builds though. Some things to check: Are all your .dlls in 
the same location as your rust executable? If not, are they in the PATH? Are 
you using the MSVC IUP dlls? If so, do you the mscrt140 redistribution dll 
installed? If none of that works, download Process Monitor from Microsoft's 
SysInternals suite and add a filter for your .exe and see what it's doing at 
runtime. It's not always clear from Windows error messages what the root cause 
was.

https://docs.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-search-order

Matt


___
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users