Re: [Lcms-user] Problem in method wrapper for c# application

2013-02-23 Thread Sebastien Leon
Hi Devon, Just call cmsCloseProfile(hInProfile) and cmsCloseProfile(hOutProfile) after your call to cmsCreateTransform (lcms keep an internal reference to the profiles used by any allocated transform) And call cmsDeleteTransform(hTransform) once cmsDoTransform is done. If the 2 icc profiles are

Re: [Lcms-user] Problem in method wrapper for c# application

2013-02-22 Thread Christian Schmitz
On 22.02.2013, at 23:38, Devon Yoo <9tontr...@gmail.com> wrote: > I have actually tried to find the right freeing function for transforms and > profiles but coudlnt find any. Can you tell me anything you know of? Please look into lcms2.h and search for delete or free or close. You probably fin

Re: [Lcms-user] Problem in method wrapper for c# application

2013-02-22 Thread Devon Yoo
Basically the icc file cannot be opened because it is in use by vshost.exe which means free(hInProfile);free(hOutProfile);free(hTransform); is wrong just like you said. I have actually tried to find the right freeing function for transforms and profiles but coudlnt find any. Can you tell me anythin

Re: [Lcms-user] Problem in method wrapper for c# application

2013-02-22 Thread Christian Schmitz
On 22.02.2013, at 22:57, Devon Yoo <9tontr...@gmail.com> wrote: > Thanks for the reply. I totally had to do the nill check where you pointed > out. But that does not solve the problem either. How about debugging? or print debug messages? FInd a way to find the line where it happens. >

Re: [Lcms-user] Problem in method wrapper for c# application

2013-02-22 Thread Devon Yoo
Thanks for the reply. I totally had to do the nill check where you pointed out. But that does not solve the problem either. Here's the new code: extern "C" __declspec(dllexport) int ToneMapping(int* intPtr, int size, char* icc1, int len_icc1, char* icc2, int len_icc2) { char* icc_1 = NULL; char* i

Re: [Lcms-user] Problem in method wrapper for c# application

2013-02-22 Thread Christian Schmitz
On 22.02.2013, at 21:36, Devon Yoo <9tontr...@gmail.com> wrote: > char* icc_1 = (char*)malloc(sizeof(char)*len_icc1 +1); > char* icc_2 = (char*)malloc(sizeof(char)*len_icc2 +1); nil checks after malloc? > hInProfile = cmsOpenProfileFromFile(icc_2, "r"); > hOutProfile = c

[Lcms-user] Problem in method wrapper for c# application

2013-02-22 Thread Devon Yoo
Hi guys, I wanted to use the smart function, "cmsDoTransform", in c# so I made my own wrapper and tried it. But while the program is running, *the first call works fine* but *the second call throws "System.AccessViolationException".* Please take a look at my code in C++ wrapper and let me know wha