You are here:

C++/using DLL in C


Hi! I write C program. How can I reference a DLL and using its function. Could I have a simple example from you. Dynamic link library has two format: .DLL and .EXE. In my case, .EXE is used.

Dear Trug,
Thankyou for your question, i hope this will help
you clarifying your concept.

a DLL is simply a set of compiled
(just like a .obj that is created by your compiler).  So, you can link
DLLs with any of your projects, the only requirements are:
1. That you know which functions are included in the DLL and
2. That you use the same compiler that was used to create the DLL.

Requirement #1 is usually simple to solve since the DLL provider
gives a header file to use.  But if you don't have any header to
you have to know the exact signature of the functions you would like to
use from the DLL, and declare them as external linkage like the

extern int someExternalFunction( void ) ;

You can now use "someExternalFunction" as any other function, but you
have to link the DLL with your project.

Requirement #2 usually forces you to use the Microsoft compiler (Visual
for instance), but other compiler can provide some tools to convert the
DLL into their own format if needed (Borland provides such tool).

As to link with a EXE, it should work since there isn't much difference
between a DLL and a EXE.  I never tried it though...

I hope this will help!
Good luck with everything!


All Answers

Answers by Expert:

Ask Experts




I can answer any question about functions,pointers,structures,object oriented programming basics of classes and data structures.My strong field is structured programming.


I have got 2 years experiece under C . I am able to answer about the structured concepts pointers to a little extent,OOP concepts. I have also experience in data Strucutres like Linked List, Stacks , Queues, Heaps, B Trees, Red Black Trees. I will try to satisfy with my knowledge. I am the Student of an expert here Martin, what i have learnt today, i just owe my every knowledge to him. He is the greatest.

©2017 All rights reserved.