Click here to Skip to main content
15,913,903 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: HOWTO: HH.exe is not listed in taskmgr.exe Pin
Richard Andrew x6418-Feb-12 10:19
professionalRichard Andrew x6418-Feb-12 10:19 
GeneralRe: HOWTO: HH.exe is not listed in taskmgr.exe Pin
Albert Holguin18-Feb-12 14:27
professionalAlbert Holguin18-Feb-12 14:27 
GeneralRe: HOWTO: HH.exe is not listed in taskmgr.exe Pin
KASR121-Feb-12 6:50
KASR121-Feb-12 6:50 
GeneralRe: HOWTO: HH.exe is not listed in taskmgr.exe Pin
Eddy Vluggen21-Feb-12 8:52
professionalEddy Vluggen21-Feb-12 8:52 
QuestionShare C file across dll boundaries Pin
LionAM17-Feb-12 12:40
LionAM17-Feb-12 12:40 
AnswerRe: Share C file across dll boundaries Pin
Chris Losinger17-Feb-12 18:09
professionalChris Losinger17-Feb-12 18:09 
AnswerRe: Share C file across dll boundaries Pin
Richard MacCutchan17-Feb-12 21:16
mveRichard MacCutchan17-Feb-12 21:16 
GeneralRe: Share C file across dll boundaries Pin
LionAM18-Feb-12 9:44
LionAM18-Feb-12 9:44 
Thank you for the answer.
In the MuPDF sample, the file is opened with
C++
int fd = _wopen(filename, _O_BINARY | _O_RDONLY, 0666);

The file descriptor fd is passed to a function defined within libmupdf. However, when this function tries to read the file (inside libmupdf):
C++
read(fd, buf, bufsize)

the function fails with the assertion
---------------------------
Microsoft Visual C++ Debug Library
---------------------------
Debug Assertion Failed!

Program: p:\OLE_PDF\Debug\OLE_PDF_Test.exe
File: f:\dd\vctools\crt_bld\self_x86\crt\src\read.c
Line: 86

Expression: (_osfile(fh) & FOPEN)


I think the proble is that the libmupdf.dll "lives" in a different address space - you cannot simply assume that resources are valid inside the dll and the exe. Therefore,
I changed the MuPDF sample so that the file is opened inside the library. Now the file is read as expected.

However, there are still other (perhaps similar problems). For example, there are global variables inside libmupdf:
C++
static fz_colorspace k_device_bgr = { -1, "DeviceRGB", 3, bgr_to_rgb, rgb_to_bgr };
fz_colorspace *fz_device_bgr = &k_device_bgr;

In the library header (which is included in the MuPDF sample), it is declared as
C++
extern fz_colorspace *fz_device_bgr;


Inside the MuPDF sample, there is a local variable
C++
fz_colorspace *colorspace = fz_device_bgr;

It is passed to the library. However, the function fails with an access violation when the dll tries to change a member of the colorspace struct. The problem is that fz_device_bgr has different values inside the dll and inside the sample (where it is undefinded?).

Alex
AnswerRe: Share C file across dll boundaries Pin
Albert Holguin18-Feb-12 10:13
professionalAlbert Holguin18-Feb-12 10:13 
GeneralRe: Share C file across dll boundaries Pin
LionAM18-Feb-12 10:38
LionAM18-Feb-12 10:38 
GeneralRe: Share C file across dll boundaries Pin
LionAM18-Feb-12 12:17
LionAM18-Feb-12 12:17 
AnswerRe: Share C file across dll boundaries Pin
Albert Holguin18-Feb-12 14:25
professionalAlbert Holguin18-Feb-12 14:25 
GeneralRe: Share C file across dll boundaries Pin
LionAM18-Feb-12 22:10
LionAM18-Feb-12 22:10 
QuestionCString reference Pin
_Flaviu17-Feb-12 3:59
_Flaviu17-Feb-12 3:59 
GeneralRe: CString reference Pin
David Crow17-Feb-12 4:05
David Crow17-Feb-12 4:05 
AnswerRe: CString reference Pin
JackDingler17-Feb-12 10:22
JackDingler17-Feb-12 10:22 
GeneralRe: CString reference Pin
JackDingler17-Feb-12 10:28
JackDingler17-Feb-12 10:28 
GeneralRe: CString reference Pin
_Flaviu17-Feb-12 19:57
_Flaviu17-Feb-12 19:57 
GeneralRe: CString reference Pin
JackDingler17-Feb-12 21:13
JackDingler17-Feb-12 21:13 
GeneralRe: CString reference Pin
Richard MacCutchan17-Feb-12 21:15
mveRichard MacCutchan17-Feb-12 21:15 
AnswerRe: CString reference Pin
bjorn_ht17-Feb-12 21:00
bjorn_ht17-Feb-12 21:00 
GeneralRe: CString reference Pin
_Flaviu19-Feb-12 9:16
_Flaviu19-Feb-12 9:16 
QuestionStatic Variable Pin
pix_programmer17-Feb-12 1:23
pix_programmer17-Feb-12 1:23 
AnswerRe: Static Variable Pin
CPallini17-Feb-12 1:48
mveCPallini17-Feb-12 1:48 
AnswerRe: Static Variable Pin
Chris Losinger17-Feb-12 1:49
professionalChris Losinger17-Feb-12 1:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.