0
Hello!
I need to create a DLL in Delphi, to use it in a program written in C++. This DLL shall handle an image (obtained by means of path passed as a function parameter).
However, I’m having trouble loading the image into the DLL; the program breaks when there is any call related to the image.
I’m using a variable of the type TImage32
(img : TImage32
); this variable shall be assigned a TBitmap32
(img.Bitmap := TBitmap32.Create
) and finally the image should be loaded using img.Bitmap.LoadFromFile(path)
.
Tests I did:
I executed the DLL, from the C++, with parts that don’t use images. This worked properly;
I executed the same section, inserting the line
img.Bitmap := TBitmap32.Create;
. That failed on the mentioned line.
Is there any trick to use images in DLL at Delphi?
OBS1: I didn’t post code because that’s not really the problem.
OBS2: my experience with Delphi is void as well as with creation of DLL.
Thank you very much!
At first it is not to have great secrets. You come to present what exception is happening? In case you do not blow the exception clearly in your application in C++ you can save the exception in a file log to have more details than this happening.
– Confundir
The image is a file on your computer, right? The path is correct? The file is in the expected format (in this case, Bitmap 32 bits per pixel)? I’m no expert on Delphi, but when I deal with images, these are the most common mistakes...
– Leonardo Alves Machado
It shouldn’t be: "img := Tbitmap32.Create;"?
– Ricardo Alves Carvalho
Aren’t you jumping the gun on your OBS1? Most likely it’s the code... there are no tricks in DLLS. The most that could happen was differences in the types of input data of the functions. For example with C# it is more difficult, in principle with C++ it would be direct
– Tiago Rodrigues