From: Larry on 31 Dec 2009 08:14 Hi, I'd like to know how I can load an external dll in C++ so I can use its API. Just for the record I would like to encode a WAVE file to MP3 so I was suggested this: http://www.linuks.mine.nu/gnustep/debs.src/lame-3.98.1/API So I have downloaded the LAME encoder and this is what I have: BladeMP3EncDLL.def lame_enc.dll readme.txt so, how can I load the DLL? thanks
From: Jeff Henkels on 31 Dec 2009 09:24 Try downloading http://www.linuks.mine.nu/gnustep/debs.src/lame-3.98.1/Dll/BladeMP3EncDLL.h; it looks like you should be able to #include that in your project. You may have to tweak it a bit to get it to compile. You can then access the LAME API either by: 1) doing LoadLibrary/GetProcAddress to get pointers to the API functions 2) Running the .def file through the lib utility (if you have MSVC or Windows SDK) to produce an import library that you can link to your app. Approach 1 is a bit more robust, in that if the DLL is not present or not the right version (i.e. one of the functions you're looking for isn't there), you can put up a nice error message telling the user exactly how to fix things, and you can allow your app to do other things that don't require the use of LAME. Approach 2 is easier to code, but if the DLL isn't there, you don't get a nice error message -- the app won't even load, as DLLs linked through import libraries are pre-loaded as part of the application's loading sequence that happens before your WinMain() or main() is called. "Larry" <dontmewithme(a)got.it> wrote in message news:4b3ca3a2$0$1121$4fafbaef(a)reader3.news.tin.it... > Hi, > > I'd like to know how I can load an external dll in C++ so I can use its > API. Just for the record I would like to encode a WAVE file to MP3 so I > was suggested this: > > http://www.linuks.mine.nu/gnustep/debs.src/lame-3.98.1/API > > So I have downloaded the LAME encoder and this is what I have: > > BladeMP3EncDLL.def > lame_enc.dll > readme.txt > > so, how can I load the DLL? > > thanks >
From: Larry on 1 Jan 2010 08:16 "Jeff Henkels" <jeff(a)mapson.jeffhenkels.com> ha scritto nel messaggio news:kMWdnd5iyryzKaHWnZ2dnUVZ_oqdnZ2d(a)speakeasy.net... > Try downloading > http://www.linuks.mine.nu/gnustep/debs.src/lame-3.98.1/Dll/BladeMP3EncDLL.h; > it looks like you should be able to #include that in your project. You > may have to tweak it a bit to get it to compile. > > You can then access the LAME API either by: > 1) doing LoadLibrary/GetProcAddress to get pointers to the API functions > 2) Running the .def file through the lib utility (if you have MSVC or > Windows SDK) to produce an import library that you can link to your app. I downloaded the lame DLL from this site: http://lame.buanzo.com.ar/ So, now I have the "lame_enc.dll" I moved in the dir of my project. what is the differences between the "BladeMP3EncDLL.h" and the "lame.h" header files?? in the first file I think there are pointers to the funztions are those like this, correct? __declspec(dllexport) VOID beVersion(PBE_VERSION pbeVersion); whereas: VOID beVersion(PBE_VERSION pbeVersion); should be a function. Now, I am studing how to access those Functions inside the DLL by using "LoadLibrary/GetProcAddress", do you think I could go with it with #include <BladeMP3EncDLL.h> then simpli calling VOID beVersion(PBE_VERSION pbeVersion); from my code??? thanks
From: Larry on 1 Jan 2010 19:46 "Larry" <dontmewithme(a)got.it> ha scritto nel messaggio news:4b3df596$0$825$4fafbaef(a)reader5.news.tin.it... > So, now I have the "lame_enc.dll" I moved in the dir of my project. > > in the first file I think there are pointers to the funztions are those > like this, correct? > __declspec(dllexport) VOID beVersion(PBE_VERSION pbeVersion); > > whereas: VOID beVersion(PBE_VERSION pbeVersion); should be a function. > > Now, I am studing how to access those Functions inside the DLL by using > "LoadLibrary/GetProcAddress", do you think I could go with it with > #include <BladeMP3EncDLL.h> then simpli calling VOID > beVersion(PBE_VERSION pbeVersion); from my code??? I read up on how to load DLL and now I am more aquainted with it. Yet, I'm exepriencing this problem: .... #include "BladeMP3EncDLL.h" void main() { PBE_VERSION pb; HINSTANCE hdll = LoadLibrary("lame_enc.dll"); BEVERSION beVersion = (BEVERSION) GetProcAddress(hdll,"beVersion"); beVersion(pb); } I get this: The variable 'pb' is being used without being initializated what am I doing wrong?? thanks
From: ScottMcP [MVP] on 1 Jan 2010 19:55 On Jan 1, 7:46 pm, "Larry" <dontmewit...(a)got.it> wrote: > I read up on how to load DLL and now I am more aquainted with it. Yet, I'm > exepriencing this problem: > > ... > #include "BladeMP3EncDLL.h" > void main() > { > PBE_VERSION pb; > > HINSTANCE hdll = LoadLibrary("lame_enc.dll"); > BEVERSION beVersion = (BEVERSION) GetProcAddress(hdll,"beVersion"); > beVersion(pb); > > } > > I get this: The variable 'pb' is being used without being initializated > > what am I doing wrong?? thanks That is a warning, not an error. Does beVersion expect you to pass a PBE_VERSION full of garbage values? If so you're OK. But I suspect not!
|
Next
|
Last
Pages: 1 2 Prev: Difference in speed between Linux GCC and VS .NET 2003 Next: Mouse Clk Shd Show Bitmap |