Shared library string safety?

evilrat evilrat666 at gmail.com
Mon Jan 13 22:40:49 PST 2014


On Tuesday, 14 January 2014 at 05:50:37 UTC, Mineko wrote:
> Alright, so I FINALLY got shared libraries somewhat working 
> through my program, however I have some issues transferring 
> data between the shared library and the main program, the 
> problem is between 
> https://github.com/MinekoRox/Breaker-Engine/blob/master/src/breaker/utility/settings.d 
> and 
> https://github.com/MinekoRox/Breaker-Engine/blob/master/res/scripts/core/settings.d
>
> The settings script is loaded by 
> https://github.com/MinekoRox/Breaker-Engine/blob/master/src/breaker/utility/core.d
>
> And, this is the error I get:
> +start(string[])
> Starting up the program
> 800600 ����B
> Shutting off the program
> Writing logs to disk
> ERROR: Error(s) occured, check the error log
> -start(string[])
> +stop()
> Segmentation fault (core dumped)
>
> The 800600 is width and height, the problem is the binary 
> output of what's supposed to be a string.

are you set your gc proxies for shared libs, right?

if not, i think it would be safer to do string.dup(as with other 
arrays) when moving them between shared lib boundaries. but still 
keep in mind that current GC may not handle properly multiple 
intances.

p.s. i don't do shared libs for non-Windows platform for a long 
time now, so it may be outdated info for now...


More information about the Digitalmars-d-learn mailing list