SelectMgr_Frustum<N>::DumpJson does not allow dllimport definition?

easternbun

CAD practitioner
On my project I try to use a dll containing TKV3d, and use the program's API to build my program.
When compiling my code, it gives error C2491 “SelectMgr_Frustum<N>: DumpJson”: does not allow dllimport function definition.

How to fix this problem?
 
Last edited:

natalia

Moderator
Staff member
Hello @easternbun ,

I haven’t seen this error though use TKV3d library freely. Now I use OpenCascade 7.6.0.
First what I did to check your case is compared sources between version 7.6.0 and 7.7.0.
There is a difference in this code, related to issue https://tracker.dev.opencascade.org/view.php?id=33054

In 7.6.0 we have:
C++:
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;

In 7.7.0 we have:
C++:
inline virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;

The latest code looks more correct, but have no ‘inline’ word in ‘.lxx’ implementation of ‘DumpJson’ (as similar implementations in ‘.lxx’ have). May be, it’s the reason?

If you compile OCCT, it’s worth to add this key ‘inline’ into ‘.lxx’ (or restore export decaration), if you just load ready release of OpenCascade, it’s worth to try 7.6.0 release to check whether this error exists with it.

By the way, what platform you use to compile your program? It’s a strange error because, as I know, OpenCascade library is tested thoroughly, even with own products based on it.

Regards, Natalia
 
Last edited:

easternbun

CAD practitioner
Hello @easternbun ,

I haven’t seen this error though use TKV3d library freely. Now I use OpenCascade 7.6.0.
First what I did to check your case is compared sources between version 7.6.0 and 7.7.0.
There is a difference in this code, related to issue https://tracker.dev.opencascade.org/view.php?id=33054

In 7.6.0 we have:
C++:
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;

In 7.7.0 we have:
C++:
inline virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;

The latest code looks more correct, but have no ‘inline’ word in ‘.lxx’ implementation of ‘DumpJson’ (as similar implementations in ‘.lxx’ have). May be, it’s the reason?

If you compile OCCT, it’s worth to add this key ‘inline’ into ‘.lxx’ (or restore export decaration), if you just load ready release of OpenCascade, it’s worth to try 7.6.0 release to check whether this error exists with it.

By the way, what platform you use to compile your program? It’s a strange error because, as I know, OpenCascade library is tested thoroughly, even with own products based on it.

Regards, Natalia
Thank you very much for replying.
I later found its just a environment setting error, my program has inherented a OCCT Macro that tries to export instead of importing the function, thus creating the error.
 
Top