Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@gonkc
Copy link
Contributor

@gonkc gonkc commented May 31, 2017

Hello, I'm Gonzalo Bayo, from the group working back in URJC/UPM with Pablo Toharia. Right now I'm trying to use ZeroBuf in a custom C++ project in Windows and the generated ipp files don't compile if we use this library in more than one project. Visual Studio compiler reject the compilation with an LNK2005( function/method already defined ).
Modifying the zerobufCxx.py file by adding the "inline" keyword before function definitions on ipp files could be an option to fix this and make errors disappear.
Regards

@bbpbuildbot
Copy link

Can one of the admins verify this patch?

(classname + '::') if classname else '', impl_function))
else:
file.write('inline {0} {1}{2}\n{{'.format(self.ret_val,
(classname + '::') if classname else '', impl_function))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid code repetition, add inline as an additional format parameter and use a variable which can be empty?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed with a new parameter on format string.

@rdumusc
Copy link

rdumusc commented May 31, 2017

looks OK to me, but we have to remove shallow = true from .gitmodules to make CI pass

@gonkc gonkc reopened this Jun 1, 2017
@bbpbuildbot
Copy link

Can one of the admins verify this patch?

@gonkc
Copy link
Contributor Author

gonkc commented Jun 1, 2017

We've getting some errors making the compilation with cpp files with 'inline' keyword. To solve that, 'inline' keyword only is used on inline implementations (ipp files).
Regards

Copy link

@rdumusc rdumusc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix. Please rebase your PR on #85 to fix the CI build, which is needed for merging.

import sys
from collections import namedtuple, OrderedDict

inline_implementation = False
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless there is a good reason for this global "option" I would remove it and always add inline

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that it won't work. In Linux these functions are not inline and I would not force the use of inline functions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check 7ab0058; there is already enough code to decide if to use inline on Windows, and not-inline everywhere else. I wonder why I forgot the inline back then, it seemed to have worked, but that's obviously not working.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed global default value of inline_implementation and global keyword. Only needed read access to variable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rdumusc , review this change, please. Thanks.

(classname + '::') if classname else '', impl_function))
add_before_inline = ""
add_after_inline = ""
if inline_implementation is True:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to compare against 'True'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's right, I forgot to remove it. Now it's fixed. Thanks.

Copy link
Contributor

@dnachbaur dnachbaur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good otherwise. Thx for the fix!

@rdumusc
Copy link

rdumusc commented Jun 6, 2017

retest this please

@rdumusc rdumusc merged commit 85e8d86 into HBPVIS:master Jun 6, 2017
@gonkc gonkc deleted the fixed_ipp branch September 11, 2018 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants