Re: How to load multiple shared libraries?

2020-06-26 Thread Javi
Just load `libmsg.so` and get the address of the symbols that you need. If `libmsg.so` depends on `libnet.so` then the OS loader (`ld`) should load automatically `libnet.so` if `libmsg.so` is implicitly linked with `libnet.so` (you can check the `.dynamic` section of `libmsg.so` with `readelf` (

Re: Exporting string functions from DLLs

2020-06-13 Thread Javi
It's normal, if you compile the DLL with `--noMain` then the function DllMain() is not created and the Nim system is not initializated calling NimMain() in DllMain() and the app crashes. If you compile the DLL **without** `--noMain` it generates this initialization code and NimMain() is called

Re: moveFile

2020-04-21 Thread Javi
OK, it's done.

moveFile

2020-04-21 Thread Javi
Hello, The documentation of **moveFile** says _" If dest already exists, it will be overwritten"_, but it raises an exception: .nim(94)raiseOSError Error: unhandled exception: No se puede crear un archivo que ya existe. Additional info: "(\"b86257abd65a5deb.tmp\"

Re: Return type

2020-04-19 Thread Javi
I've made several tests and the suggestion of @Hlaaftana works very well, thanks! proc encrypter*(data: string or seq or array, key: string): typeof(data) = Run

Re: Return type

2020-04-18 Thread Javi
Thanks you for your replies. > So I think there is no solution for you. Can you tell us what you want to > archive? Yes, I've made a little XOR encrypter/decrypter for strings, seqs and arrays. It works perfectly but I was wondering if it was possible to do it using only one function instead o

Return type

2020-04-18 Thread Javi
Hello, Suppose this pseudo function: proc fn[T](x: openarray[T]): ? Run Here **x** can be a string, a seq or an array, right? Is there any way to return a string when **x** is a string, a seq when **x** is a seq and an array when **x** is an array? Thank you.

Re: Generic openarray param

2016-10-28 Thread Javi
Thank you. Wouldn't be a good idea to expand internally a convertible type like _openarray_ before matching? For example, expand **test[T](x: openarray[T])** as **test[T](x: (seq|array)[T])** And maybe create also a priority queue to try to match first with non-generic functions, and then try

Re: Generic openarray param

2016-10-27 Thread Javi
Thank you Jester. But I meant if it's possible keep both functions, similar to template specialization for function overloading in C++. I think the Nim compiler should make the call to the second "test" proc as a specialization of the first proc, no?

Generic openarray param

2016-10-27 Thread Javi
Hi, Is there any way in Nim to solve this? Or is a bug? proc test[T](x: T) = echo x proc test[T](x: openarray[T]) = for i in x: echo i test([1, 2, 3]) It does not compile because the first "test" proc is called instead of the second.