Hi,

>   if (!opdlgMain->Execute()) exit; //PictureOpenDialog

You are doing somehow like

    if (..condition...) exit;

But 'exit' is not a keyword on C++. Moreover, 'exit' is a
function defined in stdlib, and this equals to an expression
containing function adress, and thus, ignored.

I guess you mean

  if (!opdlgMain->Execute()) return;

Or something similar.

Probably the memory corruption comes from opdlgMain->FileName
being NULL.

Besides, with BCB you need not the DLL. The library does contain
all needed to link statically.

Regards,
Mart� Maria
The little cms project
http://www.littlecms.com
[EMAIL PROTECTED]


----- Original Message -----
From: "Auke Nauta" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, August 01, 2002 4:49 PM
Subject: [Lcms-user] BCB6 and LCMS.DLL?


> Hi,
>
> I'm an inexperienced C++ programmer with some background in CM / Digital
> Imaging..
> Unfortunately,  I'm having a problem getting Little cms to work properly
> using Cbuilder 6.0.
>
> This is what I did to 'enable LCMS' on my system (please tell me if I
> screwed up!):
>
> I opened the project group LCMS109.BPG from the BCB4 folder and did a Build
> All.
> I used the resulting lcmsdll.dll and lcms109.lib in my own project (I added
> the lcms109.lib to my project and put the lcmsdll.dll file in my project
> directory).
> Furthermore (of course) I included lcms.h in my header file.
>
> In principle I could now use the functionality of lcms in my own program.
>
> BUT, a nasty error crept in, just have a look at my code:
>
> {
>   /* 1: open image */
>   Graphics::TBitmap *mybitmap=new Graphics::TBitmap();
>   Graphics::TBitmap *newbitmap=new Graphics::TBitmap();
>
>   if (!opdlgMain->Execute()) exit; //PictureOpenDialog
>   mybitmap->LoadFromFile(opdlgMain->FileName); //bmp file in this example
>   newbitmap->Assign(mybitmap);
>
>   /* 2: profile stuff related to lcms */
>   cmsHPROFILE hInProfile, hOutProfile;
>   cmsHTRANSFORM hTransform;
>
>   hInProfile  = cmsOpenProfileFromFile("Dimage 7i CWB c4b1.icm", "r");
> //ERROR OCCURS HERE!!!
>   hOutProfile = cmsOpenProfileFromFile("sRGB Color Space Profile.icm", "r");
>   hTransform =
> cmsCreateTransform(hInProfile,TYPE_BGR_8,hOutProfile,TYPE_BGR_8,
>     INTENT_RELATIVE_COLORIMETRIC, 0);
>
>   /* 3: actual colour transform */
>   for (int y=0;y<mybitmap->Height;y++) {
>     unsigned char* ptr=(unsigned char*)mybitmap->ScanLine[y];
>     unsigned char* nwptr=(unsigned char*)newbitmap->ScanLine[y];
>     cmsDoTransform(hTransform, ptr,nwptr,mybitmap->Width);
>   }
>
>   /* 4: cleanup */
>   cmsCloseProfile(hInProfile);
>   cmsCloseProfile(hOutProfile);
>   cmsDeleteTransform(hTransform);
>
>   delete mybitmap;
>   delete newbitmap;
> }
>
> When this code is executed an error message occurs at 2:  hInProfile  =
> cmsOpenProfileFromFile...
> 'Access violation at address xxxxxxxx in module cc3260mt.dll'
>
> So there seems to be some memory conflict here.
>
> --> Now, when the code is shuffled, that is part 1 (open image) is swapped
> with part 2 (profile stuff) the code executes fine -once-.
> When I want to execute the code the 2nd time, the same error message happens
> at the same point.
>
> And now the weirdest part:
> When the pictureopendialog (  if (!opdlgMain->Execute()) exit; ) is replaced
> by:
>   opdlgMain->FileName="my filename.bmp";
> the code runs flawlessly, any number of times.
>
> So there actually seems to be a conflict involving lcms and
> pictureopendialog. When the opendialog is skipped, the problems are gone.
>
>
>
> Please could anyone shed some light on this matter?
>
> Thanks and have a nice day,
>
> Auke Nauta
>
>
>
>
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Lcms-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/lcms-user
>
>



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Lcms-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/lcms-user

Reply via email to