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!

Writing a DLL?

Status
Not open for further replies.

inetd

Technical User
Jan 23, 2002
115
HK
How can I write a DLL which can be used by another programing langage(for example, Visual foxpro)?

Thanks.
 
Hi,
Select file->new->Dll wizard in the builder IDE for C++ 5.0 then declare the function name as follows
extern 'C' __declspec(dllexport)<datatype> <function <name>(<parameter list>);
write the function as with all other functions.
<datatype> <function <name>(<parameter list>)
{
//statements
}
in the main program call the function in dll as follows
extern &quot;C&quot;
{
<data type> __declspec(dllimport) <function name>(<function parameters>);
}
Please also read the commentary above the new dll unit file once its created in the IDE. For compatibility to other programs I assume this should work but in case it doesn't try the borland help.
 
Also look at Bytamin-C's site for an article on DLL's ( Another place to look is C++ Developer's Journal ( Some of their older article are online. James P. Cottingham

When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute and it's longer than any hour. That's relativity.
[tab][tab]Albert Einstein explaining his Theory of Relativity to a group of journalists.
 
Creating DLLs in C++Builder

in the builder help files steps you through a sample
dll. It dont do much but it gives you a working example.

tomcruz.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top