Log in

View Full Version : avisynth visual studio 2005 c++ compile x64


fenomeno83
1st December 2010, 11:26
I have problem to compile to 64bit with visual studio!

I use this:


PVideoFrame FilteringAvisynth::EqualizeAvs(string src)
{

PVideoFrame pf=NULL;

try
{

//load plugin to equalize source image
env->Invoke("LoadPlugin", "AGC.dll");

//read image from path invoking ImageReader avisynth internal filter
AVSValue input = env->Invoke("ImageReader", src.c_str());

//convert into YV12 (next filter need this color space) invoking ConvertToYV12 avisynth internal filter
input = env->Invoke("ConvertToYV12", input);

//equalize image invoking HDRACC avisynth external filter from AGC.dll
input = env->Invoke("HDRAGC", input);

//convert into RGB invoking ConvertToRGB avisynth internal filter
input = env->Invoke("ConvertToRGB", input);

//adjust rgb image
AVSValue par3[4] = {input,1.0,1.04,1.0};
input = env->Invoke("RGBAdjust", AVSValue(par3,4));

//write image (will write after GetFrame method) in a temp file invoking ImageWriter avisynth internal filter and return it in a PClip invoking AsClip method
//will be write in format (src + "000000.jpg")
AVSValue par7[5] = {input,src.c_str(),0,0,"jpg"};
PClip clip = env->Invoke("ImageWriter", AVSValue(par7,5)).AsClip();

//extract the first frame from PClip, that represents equalized RGB image, using GetFrame method
pf = clip->GetFrame(0,env);

}
catch (AvisynthError err)
{
printf("%s\n", err.msg);
}

return pf;
}[/I]

So before I changed in avisynth.h
void* operator new(unsigned size);
in
void* operator new(size_t size);

because I had errors..

but at last I have these errors:
error LNK2001: unresolved external symbol "class IScriptEnvironment * __cdecl CreateScriptEnvironment(int)" (?CreateScriptEnvironment@@YAPEAVIScriptEnvironment@@H@Z)

ps: I put avisynth.dll devil.dll(taken from windows\syswow64 directory) and agc.dll in working directory
I include avisynth.h
I link avisynth.lib, but have link errors when compile in x64 (with same included directories in win32 mode it works!)

Help me please

Thanks

kemuri-_9
1st December 2010, 14:07
the avisynth.lib provided by the avisynth installation normally is only for x86, you'll have to get one for x64 from somewhere else.
possibly from JoshyD or squid_80 as they're primarily the ones that have built avisynth x64.

also the 32bit avisynth and devil dll are naturally incompatible with x64 programs, so you'll also need to get x64 versions of both to be able to use this x64 filter.

fenomeno83
1st December 2010, 14:46
the avisynth.lib provided by the avisynth installation normally is only for x86, you'll have to get one for x64 from somewhere else.
possibly from JoshyD or squid_80 as they're primarily the ones that have built avisynth x64.

also the 32bit avisynth and devil dll are naturally incompatible with x64 programs, so you'll also need to get x64 versions of both to be able to use this x64 filter.

I also tried several avisynth x64..
version from squid_80 has only avisynth.dll (no devil.dll)
versions from joshyd have both..
but I use avisynth.lib and avisynth.h from official avisynth 2.5.8..

so, in all cases I have the same error

fenomeno83
2nd December 2010, 16:28
any help?

kemuri-_9
3rd December 2010, 00:10
you can either
A) try to make your own avisynth.lib for x64 using avisynth.def in the repository with msvc's lib util, though i'm not currently sure how well this will work as CreateScriptEnvironment is not decorated inside of it (e.g. that is i'm not sure if you'll need to extern "C" the declaration in avisynth.h here)...

B) not use avisynth.lib and load avisynth.dll, looking for CreateScriptEnvironment within it with GetProcAddress (like how avs2yuv does it)

fenomeno83
19th January 2011, 09:36
thanks..I will try...but will can I use also external filters autolevels for example, or only avisynth internal filters?

kemuri-_9
19th January 2011, 14:33
huh?

you can call Invoke on anything avisynth understands/recognizes,
so if the filter has been loaded into avisynth you can call functions from it.
this being granted that a 64bit version of the plugin exists for use with 64bit avisynth.
if not, then you're in rougher waters.

fenomeno83
19th January 2011, 14:39
huh?

you can call Invoke on anything avisynth understands/recognizes,
so if the filter has been loaded into avisynth you can call functions from it.
this being granted that a 64bit version of the plugin exists for use with 64bit avisynth.
if not, then you're in rougher waters.

so, this means that for avisynth 64bit I can use only specific 64 bit external plugins?
So, if there isn't for example a 64 bit version of external filter autolevel.dll i can't call invoke on it on a 64 bit project? :)

kemuri-_9
20th January 2011, 00:37
So, if there isn't for example a 64 bit version of external filter autolevel.dll i can't call invoke on it on a 64 bit project? :)

correct.