Re: optlink and weak symbols

2012-10-19 Thread Jacob Carlborg
On 2012-10-19 02:30, Ellery Newcomer wrote: extern(C) extern export PyTypeObject PyType_Type; seems to do the trick (I'm using a boiled down case just now)! High five to the [non-me] non-windows dev! Hehe, high five :) -- /Jacob Carlborg

Re: optlink and weak symbols

2012-10-18 Thread Jacob Carlborg
On 2012-10-18 05:12, Ellery Newcomer wrote: nice tip, but adding extern doesn't change link behavior at all. Hmm, are you linking with the DLL (the import library) ? In not, you need to use dlopen, or what the corresponding Windows function is. -- /Jacob Carlborg

Re: optlink and weak symbols

2012-10-18 Thread Regan Heath
On Thu, 18 Oct 2012 07:41:16 +0100, Jacob Carlborg d...@me.com wrote: On 2012-10-18 05:12, Ellery Newcomer wrote: nice tip, but adding extern doesn't change link behavior at all. Hmm, are you linking with the DLL (the import library) ? In not, you need to use dlopen, or what the

Re: optlink and weak symbols

2012-10-18 Thread Ellery Newcomer
On 10/17/2012 11:41 PM, Jacob Carlborg wrote: On 2012-10-18 05:12, Ellery Newcomer wrote: nice tip, but adding extern doesn't change link behavior at all. Hmm, are you linking with the DLL (the import library) ? In not, you need to use dlopen, or what the corresponding Windows function is.

Re: optlink and weak symbols

2012-10-18 Thread Jacob Carlborg
On 2012-10-18 13:55, Ellery Newcomer wrote: I am using python27_digitalmars.lib, which is generated from libs\python27.lib with coffimplib, and it is linking my executables with python.dll. Ok. Do you know how the corresponding C code would look like? Maybe you need to use the export

Re: optlink and weak symbols

2012-10-18 Thread Ellery Newcomer
On 10/18/2012 11:36 AM, Jacob Carlborg wrote: On 2012-10-18 13:55, Ellery Newcomer wrote: I am using python27_digitalmars.lib, which is generated from libs\python27.lib with coffimplib, and it is linking my executables with python.dll. Ok. Do you know how the corresponding C code would look

Re: optlink and weak symbols

2012-10-17 Thread Jacob Carlborg
On 2012-10-17 07:07, Ellery Newcomer wrote: I am interfacing with some C code [python.dll], which has some structs declared like so: PyTypeObject PyType_Type; I wish to be able to link to PyType_Type like so: extern(C) __gshared PyTypeObject PyType_Type; in linux, I can do exactly that, but

Re: optlink and weak symbols

2012-10-17 Thread Ellery Newcomer
On 10/16/2012 11:16 PM, Jacob Carlborg wrote: You need to declare the variable as extern if it's defined in the C code: extern(C) extern __gshared PyTypeObject PyType_Type; http://dlang.org/interfaceToC.html#C%20Globals nice tip, but adding extern doesn't change link behavior at all.

optlink and weak symbols

2012-10-16 Thread Ellery Newcomer
I am interfacing with some C code [python.dll], which has some structs declared like so: PyTypeObject PyType_Type; I wish to be able to link to PyType_Type like so: extern(C) __gshared PyTypeObject PyType_Type; in linux, I can do exactly that, but optlink is generating a new memory location