including C3D io file leads to dllimport error on VS2013

42 views
Skip to first unread message

Alex Roy

unread,
Aug 1, 2016, 9:24:39 AM8/1/16
to BTK Users
Hi,

I am trying to create a small test software to test the C3D portion of BTK.

I used the up-to-date git repo (SHA-1: d4c03aa9e354be16265d0efe0815c09b35abc642) 13/12/2015
I used cmake (3.6.1) and chose Visual Studio 2013 with only the SHARED_LIBS option enabled.
I compiled everything in release using VS2013. The compilation went well.

Then I created an empty project using VS2013.
I added a .cpp (main) file with the following code:


#include <IO/btkC3DFileIO.h>
#include <IO/btkAcquisitionFileReader.h>
#include <IO/btkAcquisitionFileWriter.h>
#include <Common/btkPoint.h>

int main()
{
return 0;
}

Then, upon compilation, I got the following errors

code\io\btkbinaryfilestream.tpp(67): error C2491: 'btk::ByteOrderBinaryFileStream<Format>::ReadI16' : definition of dllimport function not allowed
code\io\btkbinaryfilestream.tpp(76): error C2491: 'btk::ByteOrderBinaryFileStream<Format>::ReadU16' : definition of dllimport function not allowed
code\io\btkbinaryfilestream.tpp(85): error C2491: 'btk::ByteOrderBinaryFileStream<Format>::ReadI32' : definition of dllimport function not allowed
code\io\btkbinaryfilestream.tpp(94): error C2491: 'btk::ByteOrderBinaryFileStream<Format>::ReadU32' : definition of dllimport function not allowed
code\io\btkbinaryfilestream.tpp(103): error C2491: 'btk::ByteOrderBinaryFileStream<Format>::ReadI64' : definition of dllimport function not allowed
code\io\btkbinaryfilestream.tpp(112): error C2491: 'btk::ByteOrderBinaryFileStream<Format>::ReadU64' : definition of dllimport function not allowed
code\io\btkbinaryfilestream.tpp(121): error C2491: 'btk::ByteOrderBinaryFileStream<Format>::ReadFloat' : definition of dllimport function not allowed
code\io\btkbinaryfilestream.tpp(130): error C2491: 'btk::ByteOrderBinaryFileStream<Format>::ReadDouble' : definition of dllimport function not allowed
code\io\btkbinaryfilestream.tpp(140): error C2491: 'btk::ByteOrderBinaryFileStream<Format>::Write' : definition of dllimport function not allowed
code\io\btkbinaryfilestream.tpp(150): error C2491: 'btk::ByteOrderBinaryFileStream<Format>::Write' : definition of dllimport function not allowed
code\io\btkbinaryfilestream.tpp(160): error C2491: 'btk::ByteOrderBinaryFileStream<Format>::Write' : definition of dllimport function not allowed
code\io\btkbinaryfilestream.tpp(170): error C2491: 'btk::ByteOrderBinaryFileStream<Format>::Write' : definition of dllimport function not allowed
code\io\btkbinaryfilestream.tpp(180): error C2491: 'btk::ByteOrderBinaryFileStream<Format>::Write' : definition of dllimport function not allowed

I am not sure what I am doing wrong here.

Can someone give me some pointers on where to look at to fix this problem?

Thanks a lot
Alex



Alex Roy

unread,
Aug 23, 2016, 12:15:25 PM8/23/16
to BTK Users
Hi,

I ended up creating a small class (specifically for my needs) inside the btk IO library to hide the includes that are problematic.

The small tests that I wanted to do (C3D) was successful. Now I would like to use btk in a commercial product.

Will I be infringing the license if I use my custom build of BTK (with the class I added to "hide" part of the includes?

Thanks
Alex


Alex Roy

unread,
Aug 24, 2016, 9:48:53 AM8/24/16
to BTK Users
After some investigation, I removed the custom class that I made and changed the code directly instead.

I removed the 2 .tpp includes from the .h and added them in the .cpp instead.
I also took the liberty to change all the ifdef _MSV_VER to if defined(_MSV_VER) && _MSV_VER < 1800 in regards to the stdint.h include.
From my small (very small) test, everything compiled (MSCV 2013), the dynamic linking worked and my c3d test also worked.

I would like to be able to use all of those changes as soon as possible. Can I commit the changes in the master branch or is there a protocol to follow?

Thanks,
Alex



Arnaud Barré

unread,
Aug 25, 2016, 7:56:47 AM8/25/16
to btk-...@googlegroups.com
Dear Alex,

You can submit your modifications as a pull request on GitHub: https://github.com/Biomechanical-ToolKit/BTKCore

Regarding your previous question, there is no problem using BTK into a commercial product. Can we know what product is it?

Regards,

Arnaud
> --
> You received this message because you are subscribed to the Google Groups "BTK Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to btk-users+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages