www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - using new in shared library causes access violation

reply "dd0s" <oggs gmx.at> writes:
hi,

I have a c++ program with a plugin system and i try to write a 
plugin for it.
when the plugin is loaded by the program the extern (C) int 
OnInit() method is called. so far everything works fine. But as 
soon as i try to create a new class instance a segmentation fault 
occurs ( the constructor is empty ).

Here is a screenshot with all the important code



http://imgur.com/PfvsAm4

hopefully any1 can make sense of this error :/
thank you for helping
Jun 26 2015
parent reply "Adam D. Ruppe" <destructionator gmail.com> writes:
Did you call Runtime.initialized in the D side of that 
initialization fucntion?
Jun 26 2015
parent "dd0s" <oggs gmx.at> writes:
On Friday, 26 June 2015 at 16:32:44 UTC, Adam D. Ruppe wrote:
 Did you call Runtime.initialized in the D side of that 
 initialization fucntion?
No i wasn't aware of that. Thank you so much Adam. I still don't know what it does exactly but i just call it when OnPluginInit() is called. Are you aware of any resources where i can read up on this? btw bought your D Cookbook, and like it alot :3 if any1 is looking for it http://dlang.org/phobos/core_runtime.html import core.runtime; then call Runtime.initialize();
Jun 26 2015