digitalmars.D.learn - win64 - win32.oaidl.VARIANT -> error LNK2019
- deed (16/16) Oct 31 2014 // bindings from
- Vladimir Panteleev (7/23) Oct 31 2014 Your link is failing because the .init value of the struct is not
- deed (6/12) Oct 31 2014 Thank you for your prompt reply and maintaining the bindings on
// bindings from https://github.com/CS-svnmirror/dsource-bindings-win32/blob/308739a417eaaba85a5d3ce7741fd43d3042efe0/oaidl.d --- import win32.oaidl; // The following gives linker error: error LNK2019: unresolved external // symbol _D5win325oaidl7VARIANT6__initZ referenced // in function ... VARIANT v; v.vt = VARENUM.VT_I4; v.lVal = 1; // while this works - no linker error VARIANT v = { vt: VARENUM.VT_I4, lVal: 1 }; Defining a similar structure as VARIANT with anonymous structs and unions targeting linux seemed to work fine without linker problems. What is the idiomatic way of handling this on win64?
Oct 31 2014
On Friday, 31 October 2014 at 15:56:54 UTC, deed wrote:// bindings from https://github.com/CS-svnmirror/dsource-bindings-win32/blob/308739a417eaaba85a5d3ce7741fd43d3042efe0/oaidl.d --- import win32.oaidl; // The following gives linker error: error LNK2019: unresolved external // symbol _D5win325oaidl7VARIANT6__initZ referenced // in function ... VARIANT v; v.vt = VARENUM.VT_I4; v.lVal = 1; // while this works - no linker error VARIANT v = { vt: VARENUM.VT_I4, lVal: 1 }; Defining a similar structure as VARIANT with anonymous structs and unions targeting linux seemed to work fine without linker problems. What is the idiomatic way of handling this on win64?Your link is failing because the .init value of the struct is not found. The .init will be in the object file corresponding to the module where the struct is defined, so to fix the linker error, add the win32.oaidl module to the list of modules you're compiling and linking. An easy way to do that is to use rdmd instead of dmd to build your program.
Oct 31 2014
Your link is failing because the .init value of the struct is not found. The .init will be in the object file corresponding to the module where the struct is defined, so to fix the linker error, add the win32.oaidl module to the list of modules you're compiling and linking. An easy way to do that is to use rdmd instead of dmd to build your program.Thank you for your prompt reply and maintaining the bindings on GitHub! I used dub (with dmd). The win32 files reside in another directory and the path is specified in "importPaths". If I understand you correctly, the oaidl.d file should also be specified in "sourceFiles" in the .json file?
Oct 31 2014