Derlict binding with out_of_link_module struct definitions
ParticlePeter via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Jun 7 07:11:51 PDT 2015
On Sunday, 7 June 2015 at 12:28:37 UTC, ParticlePeter wrote:
> On Sunday, 7 June 2015 at 12:12:16 UTC, Rikki Cattermole wrote:
>> On 7/06/2015 11:53 p.m., ParticlePeter wrote:
>>> Wow, sometimes tough to find a good subject and issue
>>> description.
>>> I am working on a dynamic binding to the mantle32.dll
>>> following
>>> DerelictGL and DerelictCl.
>>> Functions in the mantle dll use structs as argument types. I
>>> would like
>>> to define those structs in a module derelict.mantle.types (
>>> as in
>>> DerelictGL/CL ) and import them in module
>>> derelict.mantle.mantle. Module
>>> mantle does have the required hooks:
>>>
>>> import DerelictUtil;
>>> import some_other_module_which_needs_the_struct_definitions;
>>>
>>> // struct definitions required
>>> class DerelictMantleLoader : SharedLibLoader { ... }
>>>
>>> Unfortunatelly I get an optilink error telling me that the
>>> required
>>> structs are undefined.
>>> Putting the struct definitions back into module
>>> derelict.mantle.mantle
>>> does work, but this is not an option as it will lead to cross
>>> import
>>> issues later on. The structs are also required in module
>>> some_other_module_... and that module ( which should handle
>>> mantleExtensions ) must also be imported in module
>>> derelict.mantle.mantle.
>>>
>>> I tried using opaque structs in module mantle which also
>>> didn't work.
>>>
>>> How can I have those structs have defined in a different
>>> module than
>>> that which is linking to the dll ?
>>>
>>> Regards, ParticlePeter
>>
>> Is the source code so far up somewhere with the errors being
>> given?
>
> Nope, only a working version with all the stuff in one module,
> git DerelictMantle.
I created a version tag-less branch with the described issue and
linker problem:
https://github.com/ParticlePeter/DerelictMantle/tree/ExtensionSupport
A test project using DerelictMantle can be found here:
https://github.com/ParticlePeter/deMantleDTriangle
More information about the Digitalmars-d-learn
mailing list