Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

singleton-cpp #2

Open
Nuclear9520 opened this issue Aug 17, 2022 · 7 comments
Open

singleton-cpp #2

Nuclear9520 opened this issue Aug 17, 2022 · 7 comments

Comments

@Nuclear9520
Copy link

博主你好,我想问一下这个singleton-cpp的使用方法,或者他的使用限制在哪里?我在exe和dll中,通过singleton-cpp实例化同一个对象,发现这个对象的地址不是同一个~,这个能处理吗?

@xhawk18
Copy link
Owner

xhawk18 commented Aug 17, 2022

您用的静态库吗?singleton-cpp本身要编译成 dll

@Nuclear9520
Copy link
Author

不是,我用的是动态库,这个SingleTon-cpp我给单独整了一个dll库,发现exe和dll调用同一段代码时,代码内部的一个变量地址是不同的,大佬能帮我看看我的用法是不是哪里不太一样啊?

@xhawk18
Copy link
Owner

xhawk18 commented Aug 24, 2022

这个库就是为了解决此问题才有的,要不您贴下代码,我看看

@xhawk18
Copy link
Owner

xhawk18 commented Aug 24, 2022

还有一种可能,用clang编译才有的。singleton_cpp看到的虽然是同一个 class定义,但实际link不是同一个。
这种情况,class前要加 attribute ((visibility ("default")))

@Nuclear9520
Copy link
Author

我这里的环境是 Qt + Vs 我创建了一个测试项目,可以直接发给您,可以把您的联系方式发我邮箱吗?例如微信或者QQ? [email protected]

@Nuclear9520
Copy link
Author

Nuclear9520 commented Aug 24, 2022

文件太大了,能把您的联系方式发我邮箱么?

@xhawk18
Copy link
Owner

xhawk18 commented Aug 25, 2022

文件太大了,能把您的联系方式发我邮箱么?
qq 加你了,9608开头的

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

No branches or pull requests

2 participants