Results 1 to 3 of 3

Thread: How Do I Create a DLL?

  1. #1
    Join Date
    Nov 2005
    Beans
    349
    Distro
    Ubuntu 13.04 Raring Ringtail

    How Do I Create a DLL?

    I know how to compile source files and link the resulting objects with libraries to produce an executable. In order to use compiled code in certain environments (e.g., within the statistical package R), however, I need to create a DLL. Could anyone give me a pointer on how to do that?
    Last edited by Ubuntist; April 17th, 2012 at 07:58 AM. Reason: Spelling

  2. #2
    Join Date
    Nov 2005
    Beans
    349
    Distro
    Ubuntu 13.04 Raring Ringtail

    Re: How Do I Create a DLL?

    I finally found out how to do this. I'll post it, on the off chance somebody else is looking for the same information.

    It's simple: with the GNU compilers, just use the -shared option. For example, to create a DLL named func.dll from the C source file func.c, do

    Code:
    gcc func.c -shared -o func.dll
    That's all there is to it!

  3. #3
    Join Date
    May 2008
    Location
    UK
    Beans
    1,448
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: How Do I Create a DLL?

    Quote Originally Posted by Ubuntist View Post
    I finally found out how to do this. I'll post it, on the off chance somebody else is looking for the same information.

    It's simple: with the GNU compilers, just use the -shared option. For example, to create a DLL named func.dll from the C source file func.c, do

    Code:
    gcc func.c -shared -o func.dll
    That's all there is to it!
    Bear in mind this is not a Windows DLL (Dynamic Link Library), and any "dll" you create like this cannot be used on a windows machine.

    What you have actually created is a "shared" object library which are normally labelled as a ".so" file - but as you have seen, under linux you can call them anything you want.

    Although the naming convention is simply that (a convention) I would recommend that to avoid confusion you don't create ".dll" files for linux.
    Last edited by Tony Flury; February 18th, 2013 at 02:42 PM.
    Tony - Happy to try to help.
    Unless otherwise stated - all code posted by me is untested. Remember to Mark the Thread as Solved.
    Ubuntu user number # 24044 Projects : TimeWarp - on the fly Backups

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •