Click here to Skip to main content
15,920,632 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: how to know the values for event masks Pin
thathvamsi13-Jun-06 22:37
thathvamsi13-Jun-06 22:37 
AnswerRe: how to know the values for event masks Pin
Hamid_RT13-Jun-06 22:20
Hamid_RT13-Jun-06 22:20 
GeneralRe: how to know the values for event masks Pin
thathvamsi13-Jun-06 22:36
thathvamsi13-Jun-06 22:36 
QuestionOpen vc8 project using vc7.1 [modified] Pin
chybin13-Jun-06 20:55
chybin13-Jun-06 20:55 
QuestionError when using libavcodec dll in vc++ Pin
RahulOP13-Jun-06 20:50
RahulOP13-Jun-06 20:50 
AnswerRe: Error when using libavcodec dll in vc++ Pin
Cedric Moonen13-Jun-06 20:59
Cedric Moonen13-Jun-06 20:59 
GeneralRe: Error when using libavcodec dll in vc++ Pin
RahulOP13-Jun-06 21:09
RahulOP13-Jun-06 21:09 
GeneralRe: Error when using libavcodec dll in vc++ Pin
Cedric Moonen13-Jun-06 21:24
Cedric Moonen13-Jun-06 21:24 
RahulOP wrote:
AVCodecContext is defined in avcodec.h as struct.


Yes, basically, what you have is a pointer to a function (p4) and you try to cast this pointer to a structure AVCodecContext. Which is of course totally impossible. Why are you trying to do such a thing ? I guess it is because the function you get from the dll must return a strcture of this type, right ?

So, what you need to do, is declaring your prototype this way. Instead of:
typedef void (avcodec_alloc_context)();

write:
typedef AVCodecContext* (avcodec_alloc_context)();


Then, once you get the function from your dll (p4), simply call the function like you would do for a standard function:
AVCodecContext *avctx = p4(); 


The function will be called and it will return your pointer.

I guess you want to do that but I'm not sure. Could you confirm this please ?

Important: your typedefs must match exactly the prototype of the function inside your dll !! So, if your func returns an int, the typedef needs to return an int also.

BTW, where is this dll coming from ? Don't you have a header file and a lib file supplied with it ? This will be much easier for you.

Another thing: I see that on the top of the code snippet, you create a new VCodecContext structure (using new) but later, you assign a new value to this pointer. So, the memory is never released and you get a memory leak.



Cédric Moonen
Software developer

Charting control
GeneralRe: Error when using libavcodec dll in vc++ Pin
RahulOP13-Jun-06 21:41
RahulOP13-Jun-06 21:41 
GeneralRe: Error when using libavcodec dll in vc++ Pin
Cedric Moonen13-Jun-06 21:50
Cedric Moonen13-Jun-06 21:50 
GeneralRe: Error when using libavcodec dll in vc++ Pin
Eytukan13-Jun-06 22:11
Eytukan13-Jun-06 22:11 
GeneralRe: Error when using libavcodec dll in vc++ Pin
RahulOP13-Jun-06 22:22
RahulOP13-Jun-06 22:22 
GeneralRe: Error when using libavcodec dll in vc++ Pin
RahulOP13-Jun-06 22:16
RahulOP13-Jun-06 22:16 
GeneralRe: Error when using libavcodec dll in vc++ Pin
Cedric Moonen13-Jun-06 22:27
Cedric Moonen13-Jun-06 22:27 
GeneralRe: Error when using libavcodec dll in vc++ Pin
RahulOP13-Jun-06 22:39
RahulOP13-Jun-06 22:39 
GeneralRe: Error when using libavcodec dll in vc++ Pin
Cedric Moonen13-Jun-06 23:14
Cedric Moonen13-Jun-06 23:14 
GeneralRe: Error when using libavcodec dll in vc++ [modified] Pin
RahulOP13-Jun-06 23:29
RahulOP13-Jun-06 23:29 
GeneralRe: Error when using libavcodec dll in vc++ Pin
RahulOP14-Jun-06 21:00
RahulOP14-Jun-06 21:00 
GeneralRe: Error when using libavcodec dll in vc++ Pin
Cedric Moonen15-Jun-06 1:24
Cedric Moonen15-Jun-06 1:24 
GeneralRe: Error when using libavcodec dll in vc++ Pin
RahulOP15-Jun-06 2:53
RahulOP15-Jun-06 2:53 
GeneralRe: Error when using libavcodec dll in vc++ Pin
Eytukan13-Jun-06 22:27
Eytukan13-Jun-06 22:27 
AnswerRe: Error when using libavcodec dll in vc++ Pin
Viorel.13-Jun-06 21:00
Viorel.13-Jun-06 21:00 
AnswerRe: Error when using libavcodec dll in vc++ Pin
Eytukan13-Jun-06 22:01
Eytukan13-Jun-06 22:01 
Question[Message Deleted] Pin
angelfirefox13-Jun-06 20:07
angelfirefox13-Jun-06 20:07 
AnswerRe: CTreeCtrl Height bright Display Pin
Sarath C13-Jun-06 20:35
Sarath C13-Jun-06 20:35 

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.