www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - How do I solve this kind of conflict?

reply Marc <jckj33 gmail.com> writes:
I was using a Sqlite3 library then I included another library 
that started the conflict. From what I could tell, it seems it's 
another Sqlite3 engine that the included library uses. The link 
error is:

.dub\build\application-debug-windows-x86-dmd_2076-E7D07B7BDA58325E30A3C637FC
43AFE\foo.obj(ytdl)  Offset BA31FH Record Type 00C3
 Error 1: Previous Definition Different : _callback
 Error: linker exited with status 1
My guess is it's symbols visibility issue? and how can I solve this? But libraries has this defined:
 extern(C) int callback(void*, int, char** , char**){
I've trid mark the one without private as such but it didn't change anything. NOTE: Albeit I'm using dub, both those libraries were included directly (except the dependences of one of them).
Jan 21
parent Adam D. Ruppe <destructionator gmail.com> writes:
On Sunday, 21 January 2018 at 16:22:33 UTC, Marc wrote:
 But libraries has this defined:

 extern(C) int callback(void*, int, char** , char**){
Just rename one of the functions. It is really bad form to have extern(C) functions have a common word like this exactly because they share a namespace and make conflicts likely. I'd name one like `callback_lib_name` and the other `callback_other_lib`. You might even be able to do `alias callback = callback_lib_name;` after the definition to keep all the D code compiling with no other changes.
Jan 21