
C++/CLI
norsd
这个作者很懒,什么都没留下…
展开
-
关于函数参数压入堆栈, C#函数作为CallBack的问题@CTP
关于函数参数压入堆栈@CTP问题描述:之前使用C#的Delegate描述C++的类函数如下:///请求查询合约响应virtual void OnRspQryInstrument(CThostFtdcInstrumentField *pInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {}...原创 2020-01-16 01:17:58 · 336 阅读 · 0 评论 -
MognoDb Linux C++ Driver 编译,运行注意事项
1.MongoDb C++ Driver 一般安装于 ./usr/local目录下,在这个目录下你能看到 boost文件夹, include文件夹(内部有bsoncxx,libbson, libmongoc, mongocxx等), lib文件夹(libson,libmongoc,mongocxx的各种so文件) 2.我们使用VisualStuio编译Linux工程,工程文件的设置如下: ...原创 2018-05-26 16:27:57 · 654 阅读 · 0 评论 -
c++ 显式转换中的问题
显示转换中的问题auto test = (PCSTR)(String::Format("regex_match failed: \"%s\"", a_strAddress.c_str()));String::Format 返回一个String类型临时变量,我们把他称为 “t” 他被要求显示转化为PCSTR, 内部实现为 return this._str.c_str() 最后赋值...原创 2018-05-26 20:33:37 · 402 阅读 · 0 评论 -
Visual Studio build Linux ValidateSources FAILED
当编译Linux的程序时, VC会把所有引用的文件复制到Remote, 在这之前,他将做 ValidateSources 检查文件是否正常。如果你引用的文件被移动或者删除,将产生这个错误。 例如:1>Target _ValidateSources:1> Using "ValidateSources" task from assembly "C:\Program File...原创 2018-05-31 22:33:22 · 1057 阅读 · 0 评论 -
C++ 父类泛型中涉及到衍生类时的方法
gcc(相比较vc++)对于前置声明类不太友好class BsonArray;//BsonArray是BasicBsonValue的衍生类, 衍生类必须在Base类之后定义,所以这里只能用前置类class Bson{... template<typename T> static BasicBsonValue* From(const vect...原创 2018-06-01 01:13:56 · 1742 阅读 · 0 评论 -
c++ typeid 注意事项
typeid 对于不含有虚函数的类对象,无法识别 对于含有虚函数的对象能够识别无法准确识别任何指针对象#include "stdafx.h"#include <iostream>#include <string>using namespace std;class BaseNoVirtual{};class DeriveNoVirtual...原创 2018-06-01 09:49:24 · 1494 阅读 · 0 评论 -
Nanomsg 安装在windows下的流程
从GitHub上下载 zip https://github.com/nanomsg/nanomsg官方Readme.md中关于Windows的安装方法很简单,如果你完全照做可能编译后是一个32bit的nanomsghttps://github.com/nanomsg/nanomsg/issues/859 有人提出了解决方法 : mkdir build cd build cmake -...原创 2018-07-30 14:55:54 · 3419 阅读 · 1 评论 -
C++11 std::unique_lock与std::lock_guard区别及多线程应用实例
参考:https://blog.youkuaiyun.com/tgxallen/article/details/73522233转载 2018-12-13 23:27:17 · 226 阅读 · 0 评论 -
c++ 编译找不到 .pch
Reference:https://www.viva64.com/en/b/0265/Enable precompiled headers in all configurations for all *.cpp files. It can be done on the “Precompiled Header” tab:a. Set the value “Use (/Yu)” for the ...转载 2019-01-30 21:18:37 · 572 阅读 · 0 评论 -
c++.net 编译错误: C2338:two-phase name lookup is not supported for C++/CLI, C++/CX, or OpenMP...
c++.net 编译错误: C2338:two-phase name lookup is not supported for C++/CLI, C++/CX, or OpenMP在Project的 Property页面中,C/C++, Language, Conformance mode: 调整为No原创 2019-08-21 18:28:13 · 2406 阅读 · 0 评论 -
在修改dll名字后如何使lib重建,定向到新名字的dll
ref:https://blog.youkuaiyun.com/GG_SiMiDa/article/details/81742924因为工作需要区分不同版本的dll(名字相同), 工程中不希望动态LoadLibrary,而是用lib所以必须重建lib。将dll改名为 原名.version.dll用 pexports 生成 def: pexports -o xxx.dll > xxx.d...原创 2019-08-22 12:49:43 · 1238 阅读 · 0 评论 -
C++/CLI Managed Function To Native Callback Function
一. 关键内核System::Runtime::InteropServices::Marshal::GetFunctionPointerForDelegate此函数实现了Delegate转化为Native Function二. 具体步骤 1. 创造和Native Function 一致的Delegate Native Function:typedef bool (*ON...原创 2018-04-21 01:14:31 · 650 阅读 · 0 评论 -
C++ Class 构造时由于LazyMode 和 Copy Constructor导致的问题
这里写代码片reference: http://stackoverflow.com/questions/1993727/expanding-tuples-into-arguments原创 2017-07-27 14:41:17 · 462 阅读 · 0 评论 -
C++/CLI/VC.NET 实现OpenFileDialog的定制,使他可以选择文件夹
1.原因 前段时间需要使用OpenFileDialog选择文件夹,google上有c#的办法,比较简单,只要设置Filter=乱七八糟的符号,让所有文件都显示不出来就可以。但是这样总是有点不舒服。让我想起过去在MFC模式下创建的VC的OpenFileDialog定制,需要使用到资源文件(因为系统函数中要求你提供你的模板ID). c#也可以实现,但是必须自带res文件,这点非常麻烦,可以看这里:ht原创 2013-05-03 09:47:44 · 4555 阅读 · 0 评论 -
Managed C++ wtypes.h DATE 转化为 .net的 DateTime
http://stackoverflow.com/questions/570224/how-do-i-convert-from-mfcs-coledatetime-to-c-sharp-datetime在转化C++到 .net 时遇到这个问题 , 原来是使用 COleDateTime(DATE) 的 但是我需要的是DateTime其实DateTime有一个stati原创 2013-08-24 19:21:19 · 1234 阅读 · 0 评论 -
WindApi2 , WindOriginalApiLibrary 突然不兼容问题
1. 在新的电脑上从tfs拉下代码后编译, windori原创 2014-04-06 00:39:43 · 765 阅读 · 0 评论 -
c# 中的 protected internal 如何在 vc.net 中实现
c# 中有 protected internal 的复合访问属性,保证assembly内部访问,以及外部的派生类访问vc.net 中无法直接写上 protected internal, 其对应的写法为: public protected:在c#中观察编译后的vc.net的类将看到 public protected 被c#认为一个protected internal原创 2015-08-13 10:25:59 · 575 阅读 · 0 评论 -
如何快速将vc++的类转换为c#/cli
所有需要的工具: 1. TextTemplate 2. P/Invoke Interop Assistant 3. DotNetResolvervc++的native类一般是无法直接暴露在.net环境下用的(这里暴露的意思是其他.net可以调用) 所以我们其实总是要做一个stub,或者说adapter对于一般的结构,我们可以通过工具,复制黏贴,转化为.net的类 这里推荐工具: PI原创 2015-08-14 01:28:06 · 2046 阅读 · 0 评论 -
VC.NET 需要注意的一些问题
String^ abc = gcnew String(); String^ abc = nullptroverride .net 类方法: void Reset() override {….}属性: property virtual int Count { int get(){return this->m_Count;} set(int value){this->m原创 2016-03-08 15:18:27 · 1161 阅读 · 0 评论 -
printf汇总
Reference: http://www.cplusplus.com/reference/cstdio/printf/printf(“%02d:%02d:%02d.%03d”, hour, min, sec, ms);12:03:29.500原创 2016-05-01 19:25:42 · 508 阅读 · 0 评论 -
CountBitsSetTable
ref: http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetTableCounting bits set by lookup tablestatic const unsigned char BitsSetTable256[256] = {define B2(n) n, n+1, n+1, n+转载 2017-07-01 14:50:04 · 363 阅读 · 0 评论 -
Linux 如何改变输出的内容
auto nLineCount = _vtInfo.size();for (auto str : _vtInfo){ cout << str.c_str() << endl;}cout << "Connect Count:" << _mdAF101.GetConnectCount() << endl;cout << instrument << " " << ++_nRecevied原创 2017-08-18 10:22:57 · 562 阅读 · 0 评论 -
VC.net 创建 ref class 后, C#调用报错 Cannot create an instance of the abstract class or interface CS0144
VC.net 创建 ref class 后 C#调用报错 Cannot create an instance of the abstract class or interface CS0144同样的错误:http://computer-programming-forum.com/7-vc.net/aa44def3c57690b4.htm发现如上面链接所说原创 2013-04-27 14:43:13 · 3505 阅读 · 0 评论