Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I do .DLLs files

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I whould like to know how do I generate .DLL file from a .CPP file using a .DEF file?
 
Let's say you are working with test.cpp.
Within test.cpp you would have a couple functions - declare them like this:

extern "C" int FAR PASCAL EXPORT
test_MyFunc( char* MyChar )
{
//your code here
}

extern "C" int FAR PASCAL EXPORT
test_MyNextFunc( char* pMyChar, int iMyVar )
{
//your code here
}


Now to your .def file.
Paste between the section between the
************** to your file.

//**************
; test.def : Declares the module parameters for the DLL.

LIBRARY "test"
DESCRIPTION 'test Windows Dynamic Link Library'

EXPORTS
; Explicit exports can go here
test_MyFunc @1
test_MyNextFunc @2

//you'd keep adding functions @3, @4 etc. as your dll grows
//**************

You also need to make the appropriate changes to your project settings.
Do you need more detail?

Hope this helps.
 
I whould like to know what contents into the .DEF file to generate the .DLL file. If you know this you'll be very helpfull. Thanks,

Mamede
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top