Shared library extern (C) variables

2014-01-05 Thread Mineko
I keep getting mixed results searching for this. :\ Just as the title says, is it safe to extern (C) variables? Something like this: extern (C) auto foo = 800; And then call that from another program? Also, just because this has been bugging me for a while.. Is export broken, or it it not sup

Re: Shared library extern (C) variables

2014-01-05 Thread Jeremy DeHaan
On Sunday, 5 January 2014 at 18:22:54 UTC, Mineko wrote: I keep getting mixed results searching for this. :\ Just as the title says, is it safe to extern (C) variables? Something like this: extern (C) auto foo = 800; And then call that from another program? Also, just because this has been bu

Re: Shared library extern (C) variables

2014-01-05 Thread Mineko
On Sunday, 5 January 2014 at 19:08:44 UTC, Jeremy DeHaan wrote: On Sunday, 5 January 2014 at 18:22:54 UTC, Mineko wrote: I keep getting mixed results searching for this. :\ Just as the title says, is it safe to extern (C) variables? Something like this: extern (C) auto foo = 800; And then cal

Re: Shared library extern (C) variables

2014-01-05 Thread FreeSlave
On Sunday, 5 January 2014 at 18:22:54 UTC, Mineko wrote: I keep getting mixed results searching for this. :\ Just as the title says, is it safe to extern (C) variables? Something like this: extern (C) auto foo = 800; And then call that from another program? Also, just because this has been bu

Re: Shared library extern (C) variables

2014-01-05 Thread Mineko
On Sunday, 5 January 2014 at 19:47:46 UTC, FreeSlave wrote: Some code snippets of what you try to do would help. Maybe this example explain you something: //mod.d extern(C) int foo = 42; void changeFoo(int val) { foo = val; } //main.d import std.stdio; import mod; int main() { write

Re: Shared library extern (C) variables

2014-01-05 Thread Jeremy DeHaan
On Sunday, 5 January 2014 at 19:55:50 UTC, Mineko wrote: On Sunday, 5 January 2014 at 19:47:46 UTC, FreeSlave wrote: Some code snippets of what you try to do would help. Maybe this example explain you something: //mod.d extern(C) int foo = 42; void changeFoo(int val) { foo = val; } //mai

Re: Shared library extern (C) variables

2014-01-05 Thread TheFlyingFiddle
On Sunday, 5 January 2014 at 19:55:50 UTC, Mineko wrote: Ahh I appreciate it, but I already have that part down and good. :) I was wondering about how to use export correctly, I apologize for not being clear. Also I'll keep in mind the __gshared, never even knew about it. Export is current

Re: Shared library extern (C) variables

2014-01-06 Thread Jacob Carlborg
On 2014-01-05 22:15, TheFlyingFiddle wrote: Export is currently somewhat broken see DIP45 for an indepth explanation (link) To be able to load symbols from libraries at runtime they have to be declared with extern. "export", not "extern". This rule does not hold on linux though since it sim

Re: Shared library extern (C) variables

2014-01-06 Thread TheFlyingFiddle
On Monday, 6 January 2014 at 09:27:26 UTC, Jacob Carlborg wrote: To be able to load symbols from libraries at runtime they have to be declared with extern. "export", not "extern". Yeah typo sry.