473,486 Members | 1,640 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Help Me Get Up and Running With DLL

28 New Member
Hi All,
I want to make single file encoder with lame_enc.dll.
I have DLL Manual and it tells me steps to follow is to fill BE_CONFIG and going with other stuffs. I'm newbee with this and I need help to get started.

Google didn't help me much, I tried in other places with no avail. I hope someone here will give me a shoulder of help to get started with this library.

Thanks for your precious time
Aug 27 '09 #1
16 3989
weaknessforcats
9,208 Recognized Expert Moderator Expert
I could help if you were using Windows.
Aug 30 '09 #2
JosAH
11,448 Recognized Expert MVP
@weaknessforcats
".dll" is a windowism; us regular folks who might wear tennis shoes or an occasional python boot call it a ".so" object ;-)

kind regards,

Jos
Aug 30 '09 #3
weaknessforcats
9,208 Recognized Expert Moderator Expert
So what do they call a DLL in Unix-land?
Aug 30 '09 #4
JosAH
11,448 Recognized Expert MVP
@weaknessforcats
As I wrote above: a "shared object" (.so)

kind regards,

Jos
Aug 30 '09 #5
Banfa
9,065 Recognized Expert Moderator Expert
Apostle it is not at all clear, are you trying to write a DLL or use a DLL? I assume you are using Windows?
Aug 31 '09 #6
Apostle
28 New Member
@Banfa
Sorry guys for late reply. I was out of the net for some time now
I actually want to use dll named lame_enc.dll found here:
http://lame.sourceforge.net/

I want to make simple MP3 encoder that encodes one file from wav to mp3
I have a manual here
http://www.fi.muni.cz/~qruzicka/Smid/man.htm
But I want to get started

I will appreciate your help!
Sep 4 '09 #7
weaknessforcats
9,208 Recognized Expert Moderator Expert
Do you have a copy of Windows via C/C++ by Jeffrey Richter?

How to use a DLL is covered in excruciating detail there.

The only thing you need know at the outset is whether you want to use implicit or explicit linking. That is, do you call the DLL methods directly as you would other functions and let the compiler generate code to locate the DLL, load it, locate the funciton in the DLL and call that function each time you make a call (implicit linking) or whether you will load the DLL yourself and use GetProcAddress to locate the address of the functions in the DLL which you will keep around as function pointers to use in function calls later (explicit linking).
Sep 5 '09 #8
Apostle
28 New Member
I plan to use implicit, yet I cannot find the .lib file in lame distribution.
BTW I don't have that book!
Sep 5 '09 #9
weaknessforcats
9,208 Recognized Expert Moderator Expert
You need that book.

However, if there is no .lib file distributed with the DLL then look at the .h file that is distributed. Do you see anything like __declspec(dllimport) in the function prototypes?

If not, you cannot use implicit linking but now have to do the linking yourself explicitly at run time using LoadLibrary, GetProcAddress and a bunch of function pointers.

If the __declspec(dllimport) is there then there must be a .lib file that contains the code necessary to call the function. This is a load of the dll (if necessary) an address lookup of the function in the dll and a call to that function using that address.

Please note: The DLLs export functions do not work in C++ due to name mangling. Be sure your code is all extern"C" when referring to DLL functions. Internal DLL functions can use C++ but the interfacing functions cannot.
Sep 6 '09 #10
Apostle
28 New Member
I really wish to but here in my country such technological books are hard to have.
They are, infact difficult to get. So unless there is free PDF, I cannot have it!
Very sad to say :(
Sep 6 '09 #11
weaknessforcats
9,208 Recognized Expert Moderator Expert
Did you read this? http://en.wikipedia.org/wiki/Dynamic-link_library

Then read the MSDN topics on DLLs. There are examples there.
Sep 7 '09 #12
Apostle
28 New Member
I want to get started with THIS lame_enc.dll
I have read the MSDN and have an overview. What I miss is how to Jump start!
Sep 12 '09 #13
weaknessforcats
9,208 Recognized Expert Moderator Expert
Post a piece of the .h file that you have for the DLL.
Sep 12 '09 #14
Apostle
28 New Member
Expand|Select|Wrap|Line Numbers
  1. /*
  2.  * Blade Type of DLL Interface for Lame encoder
  3.  *
  4.  * Copyright (c) 1999-2002 A.L. Faber
  5.  * Based on bladedll.h version 1.0 written by Jukka Poikolainen
  6.  *
  7.  * This library is free software; you can redistribute it and/or
  8.  * modify it under the terms of the GNU Lesser General Public
  9.  * License as published by the Free Software Foundation; either
  10.  * version 2 of the License, or (at your option) any later version.
  11.  * 
  12.  * This library is distributed in the hope that it will be useful,
  13.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.  * Lesser General Public License for more details.
  16.  * 
  17.  * You should have received a copy of the GNU Lesser General Public
  18.  * License along with this library; if not, write to the
  19.  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  20.  * Boston, MA  02111-1307, USA.
  21.  */
  22.  
  23. #ifndef ___BLADEDLL_H_INCLUDED___
  24. #define ___BLADEDLL_H_INCLUDED___
  25.  
  26. #ifdef __GNUC__
  27. #define ATTRIBUTE_PACKED    __attribute__((packed))
  28. #else
  29. #define ATTRIBUTE_PACKED
  30. #pragma pack(push)
  31. #pragma pack(1)
  32. #endif
  33.  
  34. #ifdef    __cplusplus
  35. extern "C" {
  36. #endif
  37.  
  38. /* encoding formats */
  39.  
  40. #define        BE_CONFIG_MP3            0                                        
  41. #define        BE_CONFIG_LAME            256        
  42.  
  43. /* type definitions */
  44.  
  45. typedef        unsigned long            HBE_STREAM;
  46. typedef        HBE_STREAM                *PHBE_STREAM;
  47. typedef        unsigned long            BE_ERR;
  48.  
  49. /* error codes */
  50.  
  51. #define        BE_ERR_SUCCESSFUL                    0x00000000
  52. #define        BE_ERR_INVALID_FORMAT                0x00000001
  53. #define        BE_ERR_INVALID_FORMAT_PARAMETERS    0x00000002
  54. #define        BE_ERR_NO_MORE_HANDLES                0x00000003
  55. #define        BE_ERR_INVALID_HANDLE                0x00000004
  56. #define        BE_ERR_BUFFER_TOO_SMALL                0x00000005
  57.  
  58. /* other constants */
  59.  
  60. #define        BE_MAX_HOMEPAGE            128
  61.  
  62. /* format specific variables */
  63.  
  64. #define        BE_MP3_MODE_STEREO        0
  65. #define        BE_MP3_MODE_JSTEREO        1
  66. #define        BE_MP3_MODE_DUALCHANNEL    2
  67. #define        BE_MP3_MODE_MONO        3
  68.  
  69.  
  70.  
  71. #define        MPEG1    1
  72. #define        MPEG2    0
  73.  
  74. #ifdef _BLADEDLL
  75. #undef FLOAT
  76.     #include <Windows.h>
  77. #endif
  78.  
  79. #define CURRENT_STRUCT_VERSION 1
  80. #define CURRENT_STRUCT_SIZE sizeof(BE_CONFIG)    // is currently 331 bytes
  81.  
  82.  
  83. typedef enum
  84. {
  85.     VBR_METHOD_NONE            = -1,
  86.     VBR_METHOD_DEFAULT        =  0,
  87.     VBR_METHOD_OLD            =  1,
  88.     VBR_METHOD_NEW            =  2,
  89.     VBR_METHOD_MTRH            =  3,
  90.     VBR_METHOD_ABR            =  4
  91. } VBRMETHOD;
  92.  
  93. typedef enum 
  94. {
  95.     LQP_NOPRESET            =-1,
  96.  
  97.     // QUALITY PRESETS
  98.     LQP_NORMAL_QUALITY        = 0,
  99.     LQP_LOW_QUALITY            = 1,
  100.     LQP_HIGH_QUALITY        = 2,
  101.     LQP_VOICE_QUALITY        = 3,
  102.     LQP_R3MIX                = 4,
  103.     LQP_VERYHIGH_QUALITY    = 5,
  104.     LQP_STANDARD            = 6,
  105.     LQP_FAST_STANDARD        = 7,
  106.     LQP_EXTREME                = 8,
  107.     LQP_FAST_EXTREME        = 9,
  108.     LQP_INSANE                = 10,
  109.     LQP_ABR                    = 11,
  110.     LQP_CBR                    = 12,
  111.     LQP_MEDIUM                = 13,
  112.     LQP_FAST_MEDIUM            = 14,
  113.  
  114.     // NEW PRESET VALUES
  115.     LQP_PHONE    =1000,
  116.     LQP_SW        =2000,
  117.     LQP_AM        =3000,
  118.     LQP_FM        =4000,
  119.     LQP_VOICE    =5000,
  120.     LQP_RADIO    =6000,
  121.     LQP_TAPE    =7000,
  122.     LQP_HIFI    =8000,
  123.     LQP_CD        =9000,
  124.     LQP_STUDIO    =10000
  125.  
  126. } LAME_QUALITY_PRESET;
  127.  
  128.  
  129.  
  130. typedef struct    {
  131.     DWORD    dwConfig;            // BE_CONFIG_XXXXX
  132.                                 // Currently only BE_CONFIG_MP3 is supported
  133.     union    {
  134.  
  135.         struct    {
  136.  
  137.             DWORD    dwSampleRate;        // 48000, 44100 and 32000 allowed
  138.             BYTE    byMode;            // BE_MP3_MODE_STEREO, BE_MP3_MODE_DUALCHANNEL, BE_MP3_MODE_MONO
  139.             WORD    wBitrate;        // 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256 and 320 allowed
  140.             BOOL    bPrivate;        
  141.             BOOL    bCRC;
  142.             BOOL    bCopyright;
  143.             BOOL    bOriginal;
  144.  
  145.             } mp3;                    // BE_CONFIG_MP3
  146.  
  147.             struct
  148.             {
  149.             // STRUCTURE INFORMATION
  150.             DWORD            dwStructVersion;    
  151.             DWORD            dwStructSize;
  152.  
  153.             // BASIC ENCODER SETTINGS
  154.             DWORD            dwSampleRate;        // SAMPLERATE OF INPUT FILE
  155.             DWORD            dwReSampleRate;        // DOWNSAMPLERATE, 0=ENCODER DECIDES  
  156.             LONG            nMode;                // BE_MP3_MODE_STEREO, BE_MP3_MODE_DUALCHANNEL, BE_MP3_MODE_MONO
  157.             DWORD            dwBitrate;            // CBR bitrate, VBR min bitrate
  158.             DWORD            dwMaxBitrate;        // CBR ignored, VBR Max bitrate
  159.             LONG            nPreset;            // Quality preset, use one of the settings of the LAME_QUALITY_PRESET enum
  160.             DWORD            dwMpegVersion;        // FUTURE USE, MPEG-1 OR MPEG-2
  161.             DWORD            dwPsyModel;            // FUTURE USE, SET TO 0
  162.             DWORD            dwEmphasis;            // FUTURE USE, SET TO 0
  163.  
  164.             // BIT STREAM SETTINGS
  165.             BOOL            bPrivate;            // Set Private Bit (TRUE/FALSE)
  166.             BOOL            bCRC;                // Insert CRC (TRUE/FALSE)
  167.             BOOL            bCopyright;            // Set Copyright Bit (TRUE/FALSE)
  168.             BOOL            bOriginal;            // Set Original Bit (TRUE/FALSE)
  169.  
  170.             // VBR STUFF
  171.             BOOL            bWriteVBRHeader;    // WRITE XING VBR HEADER (TRUE/FALSE)
  172.             BOOL            bEnableVBR;            // USE VBR ENCODING (TRUE/FALSE)
  173.             INT                nVBRQuality;        // VBR QUALITY 0..9
  174.             DWORD            dwVbrAbr_bps;        // Use ABR in stead of nVBRQuality
  175.             VBRMETHOD        nVbrMethod;
  176.             BOOL            bNoRes;                // Disable Bit resorvoir (TRUE/FALSE)
  177.  
  178.             // MISC SETTINGS
  179.             BOOL            bStrictIso;            // Use strict ISO encoding rules (TRUE/FALSE)
  180.             WORD            nQuality;            // Quality Setting, HIGH BYTE should be NOT LOW byte, otherwhise quality=5
  181.  
  182.             // FUTURE USE, SET TO 0, align strucutre to 331 bytes
  183.             BYTE            btReserved[255-4*sizeof(DWORD) - sizeof( WORD )];
  184.  
  185.             } LHV1;                    // LAME header version 1
  186.  
  187.         struct    {
  188.  
  189.             DWORD    dwSampleRate;
  190.             BYTE    byMode;
  191.             WORD    wBitrate;
  192.             BYTE    byEncodingMethod;
  193.  
  194.         } aac;
  195.  
  196.     } format;
  197.  
  198. } BE_CONFIG, *PBE_CONFIG ATTRIBUTE_PACKED;
  199.  
  200.  
  201. typedef struct    {
  202.  
  203.     // BladeEnc DLL Version number
  204.  
  205.     BYTE    byDLLMajorVersion;
  206.     BYTE    byDLLMinorVersion;
  207.  
  208.     // BladeEnc Engine Version Number
  209.  
  210.     BYTE    byMajorVersion;
  211.     BYTE    byMinorVersion;
  212.  
  213.     // DLL Release date
  214.  
  215.     BYTE    byDay;
  216.     BYTE    byMonth;
  217.     WORD    wYear;
  218.  
  219.     // BladeEnc    Homepage URL
  220.  
  221.     CHAR    zHomepage[BE_MAX_HOMEPAGE + 1];    
  222.  
  223.     BYTE    byAlphaLevel;
  224.     BYTE    byBetaLevel;
  225.     BYTE    byMMXEnabled;
  226.  
  227.     BYTE    btReserved[125];
  228.  
  229.  
  230. } BE_VERSION, *PBE_VERSION ATTRIBUTE_PACKED;
  231.  
  232. #ifndef _BLADEDLL
  233.  
  234. typedef BE_ERR    (*BEINITSTREAM)            (PBE_CONFIG, PDWORD, PDWORD, PHBE_STREAM);
  235. typedef BE_ERR    (*BEENCODECHUNK)        (HBE_STREAM, DWORD, PSHORT, PBYTE, PDWORD);
  236.  
  237. // added for floating point audio  -- DSPguru, jd
  238. typedef BE_ERR    (*BEENCODECHUNKFLOATS16NI)    (HBE_STREAM, DWORD, PFLOAT, PFLOAT, PBYTE, PDWORD);
  239. typedef BE_ERR    (*BEDEINITSTREAM)            (HBE_STREAM, PBYTE, PDWORD);
  240. typedef BE_ERR    (*BECLOSESTREAM)            (HBE_STREAM);
  241. typedef VOID    (*BEVERSION)                (PBE_VERSION);
  242. typedef BE_ERR    (*BEWRITEVBRHEADER)            (LPCSTR);
  243. typedef BE_ERR    (*BEWRITEINFOTAG)            (HBE_STREAM, LPCSTR );
  244.  
  245. #define    TEXT_BEINITSTREAM                "beInitStream"
  246. #define    TEXT_BEENCODECHUNK                "beEncodeChunk"
  247. #define    TEXT_BEENCODECHUNKFLOATS16NI    "beEncodeChunkFloatS16NI"
  248. #define    TEXT_BEDEINITSTREAM                "beDeinitStream"
  249. #define    TEXT_BECLOSESTREAM                "beCloseStream"
  250. #define    TEXT_BEVERSION                    "beVersion"
  251. #define    TEXT_BEWRITEVBRHEADER            "beWriteVBRHeader"
  252. #define    TEXT_BEFLUSHNOGAP                "beFlushNoGap"
  253. #define    TEXT_BEWRITEINFOTAG                "beWriteInfoTag"
  254.  
  255.  
  256. #else
  257.  
  258. __declspec(dllexport) BE_ERR    beInitStream(PBE_CONFIG pbeConfig, PDWORD dwSamples, PDWORD dwBufferSize, PHBE_STREAM phbeStream);
  259. __declspec(dllexport) BE_ERR    beEncodeChunk(HBE_STREAM hbeStream, DWORD nSamples, PSHORT pSamples, PBYTE pOutput, PDWORD pdwOutput);
  260.  
  261. // added for floating point audio  -- DSPguru, jd
  262. __declspec(dllexport) BE_ERR    beEncodeChunkFloatS16NI(HBE_STREAM hbeStream, DWORD nSamples, PFLOAT buffer_l, PFLOAT buffer_r, PBYTE pOutput, PDWORD pdwOutput);
  263. __declspec(dllexport) BE_ERR    beDeinitStream(HBE_STREAM hbeStream, PBYTE pOutput, PDWORD pdwOutput);
  264. __declspec(dllexport) BE_ERR    beCloseStream(HBE_STREAM hbeStream);
  265. __declspec(dllexport) VOID        beVersion(PBE_VERSION pbeVersion);
  266. __declspec(dllexport) BE_ERR    beWriteVBRHeader(LPCSTR lpszFileName);
  267. __declspec(dllexport) BE_ERR    beFlushNoGap(HBE_STREAM hbeStream, PBYTE pOutput, PDWORD pdwOutput);
  268. __declspec(dllexport) BE_ERR    beWriteInfoTag( HBE_STREAM hbeStream, LPCSTR lpszFileName );
  269.  
  270. #endif
  271.  
  272. #ifdef    __cplusplus
  273. }
  274. #endif
  275.  
  276. #ifndef __GNUC__
  277. #pragma pack(pop)
  278. #endif
  279.  
  280. #endif
  281.  
  282.  
Sep 12 '09 #15
Apostle
28 New Member
After several trials, I decided to give up!
I have never been succcessful in setup any meaningful C++ projects a part from foolish learning garbages. May be another time I will give it a try again
Very sad!!
Nov 16 '09 #16
weaknessforcats
9,208 Recognized Expert Moderator Expert
The header file looks like you will need to use LoadLibrary and GetProcAddress to do the linking yourself. Google has lots of examples on how to do this.
Nov 17 '09 #17

Sign in to post your reply or Sign up for a free account.

Similar topics

9
1581
by: **ham | last post by:
"Visual Studio .NET has detected that the specified Web server is not running ASP.NET version 1.1. You will be unable to run ASP.NET Web applications or services." This is the message I get each...
8
5448
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
9
6295
by: | last post by:
Hi All, I have allready tried to ask a similar question , but got no answer until now. In the meantime, I found, that I cannot understand some thread-settings for the Main() function . If I use...
13
3596
by: Siegfried Heintze | last post by:
I refered the engineer at my hosting service to http://support.microsoft.com/default.aspx?scid=kb;en-us;825738 where he tried to follow the directions there. He said there was no such file:...
3
2424
by: stuart_white_ | last post by:
I've just upgraded from Python 2.3.3 to Python 2.4.2, and, although the new version of Python seems to be running correctly, I can't seem access the help from the interpreter. On Python 2.3.3...
2
2801
by: sgMuser | last post by:
Hi, I am not a good developer of Javascript codes. Needs this help to make some modification to this famous free javascript from Anarchos. i am using this in one of my webpage. What it does is,...
0
2198
by: Jack Wu | last post by:
Hi I've spent a good majority of my day trying to figure out how to have PIL 1.1.5 working on my OSX 10.3.9_PPC machine. I'm still stuck and I have not gotten anywhere. Could somebody please...
15
2550
by: Jay | last post by:
I have a multi threaded VB.NET application (4 threads) that I use to send text messages to many, many employees via system.timer at a 5 second interval. Basically, I look in a SQL table (queue) to...
6
1619
by: HelpME | last post by:
I wrote a program in Vb.Net that was running fine. However I am unable to install it on a couple of machines. When i run it I get a windows error message that says My Project.exe has...
0
6964
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7173
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6839
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7305
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4863
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3070
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1378
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
598
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
259
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.