Subscribe to this list via RSS Blog posts tagged in Visual C++
Visual C++2017で作ったDLLをC++Builderで使う[JAPAN] 毛利です。   Visual C++で作った64BitのDLLをC++Builderで試してみました。 まずVC++2017側のコードです。 ・・・・ extern "C" CONSOLEAPPLICATION1_API int test1(int i1) { ///This function only increments. ++i1; return i1; } extern "C" CONSOLEAPPLICATION1_API void test2(int i1, wchar_t* a) { ///Convert from int to wstring. std::wstring s{}; s = std::to_wstring(i1); ///It is not valid to allocate the wchar_t in the Visual C++ DLL and then free it in C++ Builder. ///wchar_t *a = new wchar_t[s.length() + 1]; wcscpy(a, s.c_str()); ///Finally cast to wchar_t* and return. ///return a; }   ビルドするとDLLが作られます。(ConsoleApplication1.dll)  
Use the DLL created by Visual C++2017 with C++Builder(Win64). Made a DLL with Visual C++. And I tried to use it in C++Builder. Common is 64 bits. First I will make a VC++ side DLL. //// extern "C" CONSOLEAPPLICATION1_API int test1(int i1) { ///This function only increments. ++i1; return i1; } extern "C" CONSOLEAPPLICATION1_API void test2(int i1, wchar_t* a) { ///Convert from int to wstring. std::wstring s{}; s = std::to_wstring(i1); ///It is not valid to allocate the wchar_t in the Visual C++ DLL and then free it in C++ Builder. /...
  • Page :
  • 1

Check out more tips and tricks in this development video: