mmorise / World

A high-quality speech analysis, manipulation and synthesis system
http://www.kisc.meiji.ac.jp/~mmorise/world/english
Other
1.15k stars 249 forks source link

Missing WORLD_API declarations? #115

Closed 3628800 closed 3 years ago

3628800 commented 3 years ago

Hi, I am trying to link libWorld.dylib into another project and get linker errors such as the following:

Undefined symbols for architecture x86_64:
  "_GetFFTSizeForCheapTrick", referenced from:
      ...

The project links successfully when I add WORLD_API in front of declarations in the header files, eg:

void WORLD_API Dio(const double *x, int x_length, int fs, const DioOption *option,
  double *temporal_positions, double *f0);

I compiled libWorld.dylib with WORLD_SRC and WORLD_LIBRARIES_EXPORTS defined, as suggested in macrodefinitions.h. ~~ Disclaimer: my project -does- link when I compile libWorld.dylib with the CMakeLists.txt provided in the World repo; however, that seems to dump all symbols into the global namespace: ie, from nm libWorld.dylib I get:

0000000000008690 T _InitializeDioOption
...
0000000000006870 T _MyMaxDouble
...
0000000000018960 T __Z6dctsubiPdiS_

where probably only _InitializeDioOption etc are meant to be exported... I also wanted more control over the build parameters, and wanted to create an exported CMake target for my project to use, so I was using my own CMakeLists.txt; hence the link errors. I usually prefer to compile with CXX_VISIBILITY_PRESET hidden and explicitly mark in the source code all symbols that are meant to be part of the public interface; it looked like the infrastructure for that was already in macrodefinitions.h, but I didn't actually see WORLD_API being used anywhere--is it intentionally unused? Thanks

mmorise commented 3 years ago

Thank you for your comment.

I'm afraid that I'm not the developer of macrodefinition.h. Another developer added this file as a pull request to improve the usability. So, WORLD_API is not used in the source code in the main algorithm as you suggested. The users can use the test program without these definitions and also use them if needed.

3628800 commented 3 years ago

Ok. If you think it would be useful to others, I could create a pull request to that effect; otherwise, we could close this.