473,378 Members | 1,527 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Exports In Dll

how do i export the functions wit same name but wit different paramet list using dll in .DEF FILE

like
LIBRARY "ABC"
EXPORT
XYZ



here i hav three definations of function xyz it cant link thats why
so please help me out
Oct 5 '07 #1
2 1499
weaknessforcats
9,208 Expert Mod 8TB
That you cannot do.

A DLL is an old C doo-dad and there is no function overloading in C. As a result, your three overloads in C++ must be exported using three unique names

EXPORT
XYZ1 first overload mangled name
XYZ2 second overload mangled name
XYZ3 third overload mangled name
Oct 5 '07 #2
Banfa
9,065 Expert Mod 8TB
Using a .DEF file is the old way of doing things and as wfc points out makes experting overloaded functions a little hard.

What you should do is declare you function with __declarespec(dllexport) while compiling your DLL and then declare them with __declarespec(dllimport) while compiling the executeable you are using them from.

Here is an example

DLL header file DLLTester.h
Expand|Select|Wrap|Line Numbers
  1. #ifndef DLLTESTER_INCLUDED
  2. #define DLLTESTER_INCLUDED
  3.  
  4.  
  5. #ifdef DLLTESTER_EXPORTS
  6.  
  7. #define DLLTESTER_EXPORT __declspec( dllexport )
  8.  
  9. #else   // DLLTESTER_EXPORTS
  10.  
  11. #define DLLTESTER_EXPORT __declspec( dllimport )
  12.  
  13. #endif  // DLLTESTER_EXPORTS
  14.  
  15.  
  16. extern DLLTESTER_EXPORT char Multiply(char a, char b);
  17. extern DLLTESTER_EXPORT short Multiply(short a, short b);
  18. extern DLLTESTER_EXPORT int Multiply(int a, int b);
  19. extern DLLTESTER_EXPORT long Multiply(long a, long b);
  20.  
  21.  
  22. #endif DLLTESTER_INCLUDED
  23.  
DLL header file DLLTester.cpp
Expand|Select|Wrap|Line Numbers
  1. // DLLTester.cpp : Defines the entry point for the DLL application.
  2. //
  3.  
  4. #define WIN32_LEAN_AND_MEAN        // Exclude rarely-used stuff from Windows headers
  5. #include <windows.h>
  6.  
  7. #include "dlltester.h"
  8.  
  9. BOOL APIENTRY DllMain( HANDLE hModule, 
  10.                        DWORD  ul_reason_for_call, 
  11.                        LPVOID lpReserved
  12.                      )
  13. {
  14.     return TRUE;
  15. }
  16.  
  17. DLLTESTER_EXPORT char Multiply(char a, char b)
  18. {
  19.     return a*b;
  20. }
  21.  
  22. DLLTESTER_EXPORT short Multiply(short a, short b)
  23. {
  24.     return a*b;
  25. }
  26.  
  27. DLLTESTER_EXPORT int Multiply(int a, int b)
  28. {
  29.     return a*b;
  30. }
  31.  
  32. DLLTESTER_EXPORT long Multiply(long a, long b)
  33. {
  34.     return a*b;
  35. }
  36.  
Note that DLLTESTER_EXPORTS was automatically added as a definition to the compiler command line by MSVC to indicate that we are compiling the DLL
Oct 5 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Michael Chiu | last post by:
Does anyone know of a PHP based CMS that exports its pages into static html? Exporting into PHP files would be fine too. Actually, if you know of a CMS that can create directories for new areas...
3
by: gry | last post by:
I often find myself wanting an instance attribute that can take on only a few fixed symbolic values. (This is less functionality than an enum, since there are no *numbers* associated with the...
0
by: James Conrad StJohn Foreman | last post by:
I've got various affiliates that want to be emailed a report on a weekly basis. Could I write a stored procedure that took two parameters: the affiliate's id, and a filename, and then used...
1
by: Sejal Teli | last post by:
I have a report with some check box's. When I export to an rtf file, the check box's do not appear. How do I overcome this? (Saving to a snapshot file is an option but I really need it to be rtf...
1
by: Tom E Reynolds Sr. | last post by:
Hi all, I have a simple question. I need to export a database to a *.PRN (txt) format. This worked fine in Access 97. We recently upgraded to Access 2003, and now I get an error - Cannot...
0
by: JOSHUA JACKS | last post by:
When I use the "publish it in Word" option for an Access 2000 report, the fields of long, wrapped text become single lines followed by hard-returns. Difficult for the editing that I must...
5
by: Anthony Evans | last post by:
Greetings I'm using VC++.NET to create a class library. The class library contains managed classes that wrap legacy unmanaged classes by the same name. I use regasm to register the DLL for...
2
by: Alfonso Morra | last post by:
I have a class declared as ff: class __declspec(dllexport) A { public: A() ; A(const A&) A& operator=(const A&) ; ~A() ; void doThis(void) ;
1
by: David C | last post by:
I am using an ActiveReport assembly to output tex to RTF. The bottom line is, IE does not work, but Netscape works flawlessly. IE outputs to a blank screen in RTF, whereas Netscape outputs an...
0
by: ramaraog80 | last post by:
Hi, I need a VB Script which exports data from CSV file to MySql Database Regards Ramarao G
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.