Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8789715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:29:15+00:00 2026-06-13T22:29:15+00:00

How do I write a DLL file in C ? I was looking online,

  • 0

How do I write a DLL file in C?

I was looking online, but I always get tutorials for C++, not C. I want to write my first DLL file in C. How can I do that? What would a short example be?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T22:29:17+00:00Added an answer on June 13, 2026 at 10:29 pm

    Let’s get you started on your first DLL:

    • Start Visual Studio .NET.
    • Go to menu File -> New -> Project.
    • Select Visual C++ Project, and from the Templates, select Win32 Project.
    • Give the name to your project. This will be the name of your final DLL file.
    • Press OK.
    • Select DLL from Application Type (In the Application Settings tab).
    • Check Empty Project and press Finish.

    You need to attach an empty source file to the blank project:

    • Start Solution Explorer (if it’s not displayed).
    • Right click to the Source Files, Add -> Add New Item and then select C++ File and give the name to it.
    • Press Open.

    In the opened window, enter the following code:

    #include <stdio.h>
    extern "C"
    {
        __declspec(dllexport) void DisplayHelloFromMyDLL()
        {
            printf ("Hello DLL.\n");
        }
    }
    
    • __declspec(dllexport) is an obligatory prefix which makes DLL functions available from an external application.

    • extern “C” (with braces, for scoping) shows that all code within brackets is available from “outside” the file. Although code will compile even without this statement, during runtime, you will get an error. (I leave this as an experiment for you).

    Build this application and your DLL file is ready.

    Refer to Walkthrough: Creating and Using a Dynamic Link Library for more information on how to do addition and stuff.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to write nuspec for MEF plugin. I can copy xxx.dll to content
I want to write a wrap for a DLL file, in this case for
I'm trying to write a DLL that I can import in Python (2.7), and
I want to use Microsoft.Office.Interop.Excel dll to write the data into excel sheet. I
I often write classes with a DLL export/import specification, but this seems to confuse
I am trying to write a JNI applications that uses a dll which is
For testing an existing application I wrote a dll that can be loaded into
I want to create a .dll (in C++) that uses RAPI. For this I
I'm actually looking for solution merge all DLL and EXE into single file. I
I know it's a weird question but I want to design a program that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.