Hello ALL !
Creating DLL Import Libraries
To import a random DLL, you need an import library. Any existing COFF one should work with our linker (this includes import libraries made by third parties for their DLLs, intended for use with MSVC.)
However, if you need to generate your own, you first need the definition (.def) file for the DLL. To do this, you can use the gendef.exe file from LLVM-MinGW. We aren’t shipping this yet, so you need to download it. Note that the following is third party and not verified or virus-checked by us, but the official llvm-mingw site recommends Martin Storsjö’s github for release. One release is: Release llvm-mingw 20220906 with LLVM 15.0.0 · mstorsjo/llvm-mingw · GitHub
This is only for creating x64 applications in RAD Studio.
According to this document, now in C++ Builder Rad Studio 12.2 it is possible to convert and connect third-party DLLs, including MSVC.
Does anyone have experience connecting OpenCV to the new Rad Studio?
Has anyone tried to do this?
I tried using this instruction to create *.def and *.lib files from the original OpenCV DLL MSVCRT. Everything works out, the *.def and *.lib files are created.
My code :
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
#include <opencv2/opencv.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/core/mat.hpp>
#include <opencv2/core/matx.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/core/utility.hpp>
using namespace cv;
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1* Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) {}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject* Sender)
{
Mat image = imread("image.jpg");
}
//---------------------------------------------------------------------------
An error occurred during compilation:
[ld.lld Error] ld.lld: error: undefined symbol: cv::imread(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, int)
[ld.lld Error] ld.lld: error: undefined symbol: cv::Mat::~Mat()
What’s wrong?