Thread: Compiling DLL's

  1. #1
    Registered User
    Join Date
    Aug 2004
    Posts
    5

    Compiling DLL's

    As a middle-aged Delphi programmer who has been programming in Pascal for nearly a quarter of a century, I don't know a thing about C.

    I have the source code for a DLL and someone has offered to supply some modifications to the source to add some extra functions. However, these modifications will be in C - which as I said I know absolutely nothing about.

    What do I need to be able to re-compile the DLL? Are there any free compilers which will do this? What files do I need to have with regards to the DLL source code? I have .C, .H, .DEF and .RC files, but not knowing what they are, I don't know what actually should be there.

    Learning a new language like C from scratch isn't viable when you are closer to 50 years old than 40, so I'm hoping someone on here will take pity and help guide me through the process.

    As a Delphi programmer, I'm hoping not to be treated as an 'enemy in the camp'. I'm not here to claim that Delphi is better than C or anything like that - it isn't. I just use Delphi because of my background in Pascal, so please don't flame the hell out of me.

    C is an excellent language and it's programmers are extremely talented. I'm hoping someone out there is able to help.

    Thanks in advance...

    TenerifeBaz

  2. #2
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    I myself have not DLL's before either, but I've been doing the C-languages for some time.

    Now of course they may actually be in every DLL, but those file extensions look suspiciously like files I've seen in Borland Compilers. Borland Compilers are pretty good - they're well known, and having done Delphi there's a pretty good chance you've used them too. Go to their website (www.borland.com I believe), and have a look. I've heard that they do have a free IDE (C++Builder) available for download from their website, but I'm afraid I can't confirm this.

    Dev-C++ (free download - only a few MB) is a very popular compiler, and it too does DLL's - the only reason I mention Borland is because I know I've seen those file types in my Borland Compiler.

    edit: to answer your other questions, all you need is a compiler. You can do DLL's as a project type, just like you would a Windows Application. You tell it to start a new project, it'll give you some options, and if you select DLL, it'll get some more information from you and then set up all the necessary files. When it comes time to compile, it'll know you want it in DLL form. A DLL is basically just a library of code that's partially compiled that you can use in other programs - so all you really need is a source file, but you can have other things in there too. the *.rc file contains resources - usually the data for windows forms, etc... for example.
    Last edited by sean; 08-18-2004 at 10:21 AM.

  3. #3
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    I'd try to find out what compiler is being used by the guy whos writing the extra code for you. Some features may differ between compilers when it comes to dlls. For instance the RC file relates to a resource script - some tools come with different resource compilers.

    You might be alright, but I'd want to know what the original tools were - could save you difficulty in the future.

  4. #4
    Registered User manofsteel972's Avatar
    Join Date
    Mar 2004
    Posts
    317
    This only translates c header files to pascal but maybe it will help i dunno.
    http://www.freepascal.org/tools/h2pas.html
    This one claims to translate C to pascal and be delphi compatible again i dunno
    http://www.planet-source-code.com/vb...d=331&lngWId=7
    Article might help aimed at Pascal programmers
    http://www.mactech.com/articles/mact...lUnderstandsC/
    Last edited by manofsteel972; 08-18-2004 at 05:00 PM.
    "Knowledge is proud that she knows so much; Wisdom is humble that she knows no more."
    -- Cowper

    Operating Systems=Slackware Linux 9.1,Windows 98/Xp
    Compilers=gcc 3.2.3, Visual C++ 6.0, DevC++(Mingw)

    You may teach a person from now until doom's day, but that person will only know what he learns himself.

    Now I know what doesn't work.

    A problem is understood by solving it, not by pondering it.

    For a bit of humor check out xkcd web comic http://xkcd.com/235/

  5. #5
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    Maybe a little bit, but he's still got the source file, and the resources.

  6. #6
    Registered User
    Join Date
    Aug 2004
    Posts
    5
    Thanks for the replies everyone. Having received a helpful response, I'll offer a bit more info...

    Sean:

    I wasn't sure if the extensions I quoted were compiler-specific or not. Having not used one, I had thoughts of different compilers generating different filetypes other than .c and .h but hoped that source from any C/C++ IDE could be compiled by any other. I guess from your comments that this *may* be so, but I've taken on board Fordy's comments warning that there might be issues.

    Fordy:

    The 'other guy' isn't writing any code for me. To the best of my knowledge, he will only be telling me what I need to do on top of what the DLL already does. This may or may not include some C source code.

    The AKRip DLL grabs data off audio CD's to WAV files, but he says he will tell me how to grab the sub-code CDG data as well.

    manofsteel972:

    Thanks for the links, but I don't need to convert any of the code to Pascal - I'm already using the DLL from within Delphi. What I need to do is modify some C code within the DLL and compile it back into a DLL.

    Although I have someone who can tell me what is involved, unfortunately, pressure of work does not allow him the time to assist me any further than that, though he did supply me with a link to the DLL along with all it's source code.

    The DLL itself is Andy Key's AKRip.DLL, which is open source and distributed under Gnu LGPL which will be fully adhered to.

    Unfortunately, it's unlikely that I will be able to find out which exact compiler was used to write it, (my e-mail to Andy Key was returned as undeliverable), but if anyone needs any further info, I'd be only too happy to e-mail a list of the files and any other info.

    Thanks once again...

    TenerifeBaz

  7. #7
    Registered User manofsteel972's Avatar
    Join Date
    Mar 2004
    Posts
    317
    http://akrip.sourceforge.net/buildenv.html -- ok so it says here the build eviroment is on linux using Mingw32

    gcc-2.95.2
    Last edited by manofsteel972; 08-19-2004 at 08:34 AM.
    "Knowledge is proud that she knows so much; Wisdom is humble that she knows no more."
    -- Cowper

    Operating Systems=Slackware Linux 9.1,Windows 98/Xp
    Compilers=gcc 3.2.3, Visual C++ 6.0, DevC++(Mingw)

    You may teach a person from now until doom's day, but that person will only know what he learns himself.

    Now I know what doesn't work.

    A problem is understood by solving it, not by pondering it.

    For a bit of humor check out xkcd web comic http://xkcd.com/235/

  8. #8
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398

    A few more comments:

    You need a Windows compiler... a compiler that makes Windows programs. (Microsoft didn't invent invent dynamic linking, but .dll files are for Windows.) The compiler will have an option to "Compile as DLL".

    but I'd want to know what the original tools were
    RIGHT! If the source file uses only standard-portable C++, and standard Windows library functions, then any Windows compiler should work. But, the source file may contain some compiler-specific stuff. The Dev-C++ (aka Bloodshed) IDE, recommended above by sean_mackrory, uses the Mingw compiler, so that should be an excellent choice.

  9. #9
    Registered User
    Join Date
    Aug 2004
    Posts
    5
    Sorry for the delay in getting back - I've been waiting for the e-mail detailing what needs to be done.

    The info I now have is very short and *looks* very simple - if you know what you are doing - which I don't!

    I basically need to alter the dll so that it also grabs subcode data. Although doing this looks very simple in the e-mail, my lack of skills in the subject leads me to think that it would be better done by someone who knows what they are doing.

    For one, I don't know what tools I would need. I've downloaded freecommandlinetools.exe from the Borland web site on which it says that it is a C compiler, but from what I've read above, it may not be what I need.

    Secondly, although the alterations are only tiny, am I right in thinking that once applied, then the modified dll function in question would stop working as it did before and that I would need to use both the ammended *and* the original dll? If so, then I think that another function would need to be added to the dll - once again, well above my abilities.

    Would anyone with a compatible compiler (and the necessary experience) be willing to have a crack at it for me please? If so, I will post my e-mail address (if that is allowed) and happily share the info with anyone who contacts me.

    Thanks again...

    TenerifeBaz

  10. #10
    Registered User
    Join Date
    Aug 2004
    Posts
    5
    DougDbug:

    Sorry - didn't notice your post with your compiler recommendation link. I'm following up on that now - just in case I don't get any takers and have to do it the hard way!

    TenerifeBaz

  11. #11
    Registered User
    Join Date
    Aug 2004
    Posts
    5
    For anyone tempted to assist, but think they don't have enough time, can I just say that the info I have says that the modifications required are no more than changing two values - the buffer size and a flag.

    This should take a mere few minutes to do if you know what you are doing. I now have a compiler which I believe is compatible and will have a go myself.

    If anyone is able to assist if (when) I get stuck, my e-mail address is [email protected].

    Thanks...

    TenerifeBaz

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  2. Some doubts on DLLs
    By BrownB in forum Windows Programming
    Replies: 1
    Last Post: 05-30-2007, 02:25 AM
  3. standart dlls
    By keeper in forum C++ Programming
    Replies: 3
    Last Post: 07-05-2006, 07:32 PM
  4. Can't load string from resource DLL's string table
    By s_k in forum Windows Programming
    Replies: 4
    Last Post: 07-15-2003, 06:43 AM
  5. Compiling Dll's
    By Undeadenemy in forum Game Programming
    Replies: 1
    Last Post: 06-30-2003, 08:11 PM