Segmentation fault while creating a class object by dlsym-ed function

2012-07-17 Thread Konstantin J. Chernov
Hello. When I'm trying to create a class object by using a dlsym-ed function, I'm getting a segmentation fault after execution of program. However, if I'm deleting that object before 'return 0' in main (by using 'delete b'), everything is going fine. I'm just started to learn D after using C

Re: Segmentation fault while creating a class object by dlsym-ed function

2012-07-17 Thread Jacob Carlborg
On 2012-07-18 06:51, Konstantin J. Chernov wrote: Hello. When I'm trying to create a class object by using a dlsym-ed function, I'm getting a segmentation fault after execution of program. However, if I'm deleting that object before 'return 0' in main (by using 'delete b'), everything is going f

Re: Segmentation fault while creating a class object by dlsym-ed function

2012-07-18 Thread Konstantin J. Chernov
What am I doing wrong here? Is there any way to do what I'm trying to do right way? Dynamic libraries aren't properly supported by the runtime. That's terrible:( It's so nice to make an interface, and create classes that inherit this interface dynamically, without linking... Maybe there's

Re: Segmentation fault while creating a class object by dlsym-ed function

2012-07-18 Thread bearophile
Konstantin J. Chernov: testclass.di: class testclass { this(const wstring loadmsg); ~this(); wstring foo(); }; And usually you don't need to write .di files in D. Bye, bearophile

Re: Segmentation fault while creating a class object by dlsym-ed function

2012-07-18 Thread Jacob Carlborg
On 2012-07-18 10:17, Konstantin J. Chernov wrote: What am I doing wrong here? Is there any way to do what I'm trying to do right way? Dynamic libraries aren't properly supported by the runtime. That's terrible:( It's so nice to make an interface, and create classes that inherit this interfac

Re: Segmentation fault while creating a class object by dlsym-ed function

2012-07-18 Thread Alex Rønne Petersen
On 18-07-2012 06:51, Konstantin J. Chernov wrote: Hello. When I'm trying to create a class object by using a dlsym-ed function, I'm getting a segmentation fault after execution of program. However, if I'm deleting that object before 'return 0' in main (by using 'delete b'), everything is going f

Re: Segmentation fault while creating a class object by dlsym-ed function

2012-07-18 Thread Konstantin J. Chernov
Thank you for your replies! I've found a working solution - all I needed is to change wstring to const wstring, and pass it not as func("something"), but as wstring tmp = "something"; func(tmp); That's really odd, because I don't understand, how those changes made segfault disappear. Her

Re: Segmentation fault while creating a class object by dlsym-ed function

2012-07-18 Thread Alexandr Druzhinin
Probably you mean the same problem that is described in the thread avobe, see "using GC needs particular skills?" Every time after execution my code I got very frustating access violation and the problem was misunderstanding garbage collector because I've never used it before.