Click here to Skip to main content
15,893,564 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everyone
I'm trying to use a DLL file called mp4core.dll to encode a stream of images to video
but i don't have the library for this DLL

I also tried to open this DLL and view its functions and I did but it didn't tell me anything about the parameters used in these functions or how to use them

I've found a similar function on the internet
C++
xvid_encoder(void* handle, int opt, void* param1, void* param2);

but i didn't know how to use it or where to get these parameters
Knowing that all I get is an LPBYTE raw image data that I save to a txt file.

I also founs an XVID class on the internet also didn't now how to get the parameters
C++
void init_encoder(uint32_t cpu_flags);

int enc_create(xvid_enc_create_t * create);
int enc_destroy(Encoder * pEnc);
int enc_encode(Encoder * pEnc,xvid_enc_frame_t * pFrame, xvid_enc_stats_t * stats);


Can I use the DLL without the Library?
Does anyone know how to use the ready functions? or where to get the parameters?

Thank you .
Posted
Updated 29-Jun-13 22:27pm
v2

Technically yes: you might use a DLL without having its import library (.lib file), via DLL explicit linking[^]. However, if you don't have the DLL header file (*.h), that is you don't know DLL's function signatures, then your task is extremely hard.
 
Share this answer
 
Comments
Mesa1993 30-Jun-13 4:40am    
I don't even have the header file!
I was able to load the DLL using the (LoadLibrary method) but still how can I use the functions without knowing their parameters?
You can figure out the basic information by deconstructing the decorated names[^]. However, without the documentation for the library that is unlikely to help you much. For example, knowing that parameter 1 is an int and parameter 2 is a char* gives no information as to what values are acceptable.
 
Share this answer
 
Comments
Mesa1993 30-Jun-13 8:36am    
I am stuck in this since last wednesday
The only problem is that I don't know where to get the parameters
i decided to work on the xvid encoder (in C "never actually worked with C but i have no choice")
Wish me Luck
Richard MacCutchan 30-Jun-13 12:23pm    
Well I would wish you luck, but my instinct is to say "stop wasting your time". Without some documentation that tells you what each parameter type is, and what values should be used then you are never going to figure it out.
As solutions #1 and 2 tell you, you need the .lib file to link properly.

If you don't have this, you can build a fake one. It will take a considerable amount of work. You can look at the dll with an app such as depends.exe to get all the entry points to the dll. Using undname, back translate the decorated names to what is expected in source. Then build a fake set of classes and global APIs and compile/link into a set of dll/lib files. Throw away the fake dll but use the fake lib file to link your dll of interest.

You didn't say which version of Visual Studio you have (if you have it at all). Assuming you have VS2010, depends.exe can be found at Start -> Microsoft Visual Studio 2010 -> Visual Studio Tools -> depends.exe and undname can be found as a command line tool by opening Start -> Microsoft Visual Studio 2010 -> Visual Studio Tools -> Visual Studio Command Prompt (2010). If you have a different Visual Studio version, the details will of course be a little different.

Open depends.exe and look at your dll. The list of exports is found on the lower right pane. Go to the VS command prompt, and use undname to see the undecorated name of each "Function" name in that list:

D:\blahblah\VC> undname ??0BaseMessage@@QAE@XZ
Microsoft (R) C++ Name Undecorator
Copyright (C) Microsoft Corporation. All rights reserved.

Undecoration of :- "??0BaseMessage@@QAE@XZ"
is :- "public: __thiscall BaseMessage::BaseMessage(void)"

Build your fake dll with all of these entry points present. Use depends.exe on the fake dll to make sure that it matches with the real one. Depending on how you link, you may or may not have to pay attention to the ordinal numbers. Use a .def file if necessary to get these right (if you need them). You can probably get away with just defining the entry points of interest. This will likely be an iterative process. You will spend a lot of time getting this right.

When you have these details right, use the fake .lib file to link your app to the .dll of interest.

Bazinga!
 
Share this answer
 
Comments
Mesa1993 30-Jun-13 10:27am    
Thanx for the detailed answer it really helped :)
H.Brydon 30-Jun-13 14:24pm    
Oh yeah and I suppose I left out the part about the .h file. You will need that/those as well. Pay attention to any inline methods that may be in class definitions. You will need to decompile the dll and actually implement any inline methods that are in there.

The parts you will end up using are .h file(s) and the .lib file.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900