0

I encountered a problem in my project as a function name, PropertyNotify() in couples of classes, in the FBX static library has already been defined as a macro int value in X11/X.h on Linux.

virtual bool PropertyNotify(eFbxPropertyCallback, KFbxProperty*); //kfbxobject.h

virtual bool PropertyNotify(eFbxPropertyCallback pType, KFbxProperty* pProperty); //kfbxnode.h

virtual bool PropertyNotify(EPropertyNotifyType pType, FbxProperty& pProperty); //fbxmanipulators.h

virtual bool PropertyNotify(eFbxPropertyCallback pType, KFbxProperty* pProperty); //kfbxtexture.h

#define PropertyNotify      28  //X.h

The FBX is not open source and only provides the include headers and static and dynamic library (.a and .os), hence I can only include the FBX headers in my application but cannot touch the source files. I think the naming issue may be the caused of the compilation error "expected unqualified-id before numeric constant" I have got.

I tried calling "objcopy --redefine-sym PropertyNotify=FbxPropertyNotify libfbxsdk.a" in order to redefine the function name in the static library. By doing this, the "expected unqualified-id" error was solved, however, it seemed somehow messed up the static library because it caused hundreds of undefined references error in the codes where the FBX functions or objects being called.

I am wondering what is the solution to this issue? As suggested by someone, creating a wrapper of the FBX library could probably solve the problem. If that is possible, it would be very kind if anyone could share some detailed tutorial or guidance on how to implement it on Ubuntu. Thanks in advance.

Michael Wei
  • 185
  • 2
  • 10
  • 2
    Since you are using a proprietary library, you probably bought some support for it. So use the support line. Or rename *your* `PropertyNotify` to something else, like `MichaelPropertyNotify` (and that is probably the easiest solution). – Basile Starynkevitch Dec 23 '16 at 17:17
  • I cannot access to the source files hence I do not think I can rename the function or recompile the static library after the changes. Besides, I tried to redefine the function name to others using "objcopy --redefine-sym" on terminal. It was not a good idea as it messed up the static library and caused other linking errors. – Michael Wei Dec 23 '16 at 17:35
  • I did thought of *your* code, not the FBX one.And it might happen that your problem has no easy solution, that is why I recommend working with the support given by FBX provider. – Basile Starynkevitch Dec 23 '16 at 17:43

1 Answers1

1

Perhaps you might make a wrapper shared library which would link the libfbx.so. See this answer (describing how to build a libabc.so linked to lib123.so).

But you really should ask the vendor of that FBX library for guidance. It could be that some other of theirs customers have met a similar issue, and they have already found out some workaround.

(intuitively, I don't recommend playing objcopy tricks on the proprietary libfbx.so)

You might also customize your compiler (e.g. using MELT if working with GCC...) to have it handle specifically some particular names like PropertyNotify (but I am not sure it is a good idea, and it certainly takes weeks of efforts).

Community
  • 1
  • 1
Basile Starynkevitch
  • 223,805
  • 18
  • 296
  • 547