What files do I need for a DLL to work?
What files do I need for a DLL to work?
I'm very new to IM and have no clue if I can actually do this, I would consider myself a hobbyist in the most loosest of forms.
I want to use Magick++ to read, flip, and save out an image. Simple enough.
I got a DLL out of VS17 but I want to know what else I need to include in order to get it to work, if this is even something that can happen. My hope is to get this portable to share it with some friends of mine.... which leads me to another question, does IM have to be installed on every computer or is there a way to get it to work with a bunch of the DLLs that get kicked out after the install?
Im running PC using VS17, I installed the ImageMagick-7.0.7-27-Q16-x64-dll.exe and set up my environment inside VS correctly. I put the magick++, core, and wand dlls next to my DLL in a naive attempt to try to make it work... but its not.
I also may have pointed the initializeMagick() to the wrong area. I read you can leave it blank, pass it an argument, but can you hard code it in?
Ive been trying to float around the forum gathering as much information as I could but its time I just ask for some help and clarification.
I want to use Magick++ to read, flip, and save out an image. Simple enough.
I got a DLL out of VS17 but I want to know what else I need to include in order to get it to work, if this is even something that can happen. My hope is to get this portable to share it with some friends of mine.... which leads me to another question, does IM have to be installed on every computer or is there a way to get it to work with a bunch of the DLLs that get kicked out after the install?
Im running PC using VS17, I installed the ImageMagick-7.0.7-27-Q16-x64-dll.exe and set up my environment inside VS correctly. I put the magick++, core, and wand dlls next to my DLL in a naive attempt to try to make it work... but its not.
I also may have pointed the initializeMagick() to the wrong area. I read you can leave it blank, pass it an argument, but can you hard code it in?
Ive been trying to float around the forum gathering as much information as I could but its time I just ask for some help and clarification.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: What files do I need for a DLL to work?
You are on Windows, I suppose?
Do you have a working version of IM? Does it work from the command line?
On your development machine, did you install the portable version of IM? If you did, you should be able to copy the IM directory to another Windows computer and it should work. (I haven't tried this for myself.)
Do you have a working version of IM? Does it work from the command line?
On your development machine, did you install the portable version of IM? If you did, you should be able to copy the IM directory to another Windows computer and it should work. (I haven't tried this for myself.)
snibgo's IM pages: im.snibgo.com
Re: What files do I need for a DLL to work?
Yes Windows 7, sorry I should have made that apparent from the start.
I installed the binary version in 64 bit, the command prompt check brings up the image.
I did install the portable version,do you mean the directory being all the dll files or EVERYTHING in that folder that came out of the install?
I dropped my source in, pretty sure theres stuff wrong.
I installed the binary version in 64 bit, the command prompt check brings up the image.
I did install the portable version,do you mean the directory being all the dll files or EVERYTHING in that folder that came out of the install?
I dropped my source in, pretty sure theres stuff wrong.
Code: Select all
#include "Magick++.h"
#include <cstring>
#include <iostream>
#include "Header.h"
using namespace std;
using namespace Magick;
float DLL_EXPORT FlipImage(char* imagePath)
{
InitializeMagick("");
// Construct the image object
Image image;
// Reads image from image path
image.read(imagePath);
// Flip the image vertically
image.flip();
// Write flipped image to same image path
image.write(imagePath);
// returns float
return 0.0f;
}
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: What files do I need for a DLL to work?
I'm not clear what problem you have. Have you written a program (*.EXE) that you want to distribute? Apparently you want to distribute a DLL. But what use will that be? Someone would need to write a program that uses the DLL.
Have you written a program that uses your DLL? Does it work?
InitializeMagick is usually called from the main() of a program, like this:
But if you don't have argv, I think you should pass NULL.
Have you written a program that uses your DLL? Does it work?
InitializeMagick is usually called from the main() of a program, like this:
Code: Select all
InitializeMagick(*argv);
snibgo's IM pages: im.snibgo.com
Re: What files do I need for a DLL to work?
I have a program that will call this DLL function, I didnt make it but its well established. It has minimal scripting capabilities but calling a function from a DLL is one of them. Ive gotten other DLL plug ins to work from that one, and I even had this working with OpenCV but that wasnt quite a portable solution as I found out so Im giving this a try.
Ill pass it NULL and see if that changes anything
Ill pass it NULL and see if that changes anything
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: What files do I need for a DLL to work?
Ah, okay. I don't know how to write and build a DLL that calls ImageMagick. But, fairly obviously, ImageMagick must be there to be called.thedean91 wrote:I have a program that will call this DLL function, ...
The IM executable is about 10 MB. So either the programs (like magick.exe and user-written programs) are about 10 MB, or there will be DLL files of about 10 MB with names like "Magick++-7.Q32HDRI-0.dll".
How large is your compiled DLL? If it is only about 50KB, then it obviously needs the ImageMagick DLLs to link to at runtime.
snibgo's IM pages: im.snibgo.com
Re: What files do I need for a DLL to work?
I cleaned up the code taking in your suggestions and got it to work! My compiled DLL is 14KB. It was working with IM installed and I tested running it after uninstalling IM from my computer, but kept all the DLL files that came with the exe install and it is giving me the CORE RL Magick++_ is missing from the computer.
I tried isolating my DLL, including the CORE RL Magick++ DLL, and then all the DLLs that came with the binary install. Looks like it has to be installed unless there's a way around that?
(installing it again runs my DLL properly)
I tried isolating my DLL, including the CORE RL Magick++ DLL, and then all the DLLs that came with the binary install. Looks like it has to be installed unless there's a way around that?
(installing it again runs my DLL properly)
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: What files do I need for a DLL to work?
You also need the XML files.
http://www.imagemagick.org/script/resources.php lists various environment variables like MAGICK_HOME that might need to be set in your uninstalled configuration.
http://www.imagemagick.org/script/resources.php lists various environment variables like MAGICK_HOME that might need to be set in your uninstalled configuration.
snibgo's IM pages: im.snibgo.com
Re: What files do I need for a DLL to work?
ahhh didnt know that. thanks for the reference link! ill give that a combo and see if that makes a difference.
Re: What files do I need for a DLL to work?
I got all the DLL and XML files in, still no dice with a non installed IM run