www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - linking error

reply Andrey <andrey kabylin.ru> writes:
Hello, I'm trying to expose platform specific code to another 
file, I have platform.d with just interface e.g.:

 void platformShowSystemCursor();
 
 void platformHideSystemCursor();
 
 void platformSetMousePosition(void* window, in int x, in int y);

 ...
and I created another one - platform_sdl.d with particular implementation of these functions. But it doesn't work and I get linking errors: such as
 /usr/bin/ld: 
 .dub/build/executable-debug-linux.posix-x86_64-dmd_2086-BCDE4E9CECC76CF34CB
8A744FAA3314/sim.o: in function >
`_D4rpui11application11Application6__dtorMFZv':
/home/andrey/Projects/rpui/src/rpui/application.d:45: undefined reference to > `_D4rpui8platform25platformGapiDeleteContextFPvZv' How can I resolve it?
Jul 02 2019
parent Andrey <andrey kabylin.ru> writes:
Ok, I have made it work, it's because of name mangling, I've just 
added extern(C).
Jul 02 2019