Overload DllExperted function

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Oct 2008
Posts: 25
Reputation: uim_1977 is an unknown quantity at this point 
Solved Threads: 0
uim_1977 uim_1977 is offline Offline
Light Poster

Overload DllExperted function

 
0
  #1
Oct 27th, 2008
I need to overload Dll Exported function, and the problem i'm getting is thet the compiller says only one overloaded function can be "C", how can i do this ?
  1. extern "C" __declspec(dllexport) __stdcall void CreateCustomers(TComponent *Owner);
this is the original declaration, i'm tying to overload it so here is the heder i'm compiling

  1. #ifndef DllH
  2. #define DllH
  3. #include "CustomersForm.h"
  4. extern TCustomersF* DllCustomers;
  5. extern "C" __declspec(dllexport) __stdcall void CreateCustomers(TComponent *Owner);
  6. extern "C" __declspec(dllexport) __stdcall void CreateCustomers(TComponent *Owner, AnsiString Caprion);
  7.  
  8. //---------------------------------------------------------------------
  9. #endif
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: Overload DllExperted function

 
0
  #2
Oct 27th, 2008
If you want to overload a C function, you need to do your own name mangling so that it has a unique name without any help from the compiler.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 25
Reputation: uim_1977 is an unknown quantity at this point 
Solved Threads: 0
uim_1977 uim_1977 is offline Offline
Light Poster

Re: Overload DllExperted function

 
0
  #3
Oct 27th, 2008
So dowe it mean i can not reload the function, i need to have just a different name for the function?
so it is not possible to have to functinos under one name?
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: Overload DllExperted function

 
0
  #4
Oct 27th, 2008
Well you could declare it as
CreateCustomers(TComponent *Owner, ... );
IF it's possible to look at Owner, AND figure out from that what the rest of the parameters should be.

> so it is not possible to have to functinos under one name?
Create your own really simple class around the API you're given (perhaps), which provides you with all the overloading you want.
Last edited by Salem; Oct 27th, 2008 at 3:51 pm. Reason: Fix the wacky icode tags end of line
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 25
Reputation: uim_1977 is an unknown quantity at this point 
Solved Threads: 0
uim_1977 uim_1977 is offline Offline
Light Poster

Re: Overload DllExperted function

 
0
  #5
Oct 27th, 2008
I'm sorry but i'm not experianced enoff to figer it out, did not i've done it in
extern "C" __declspec(dllexport) __stdcall void CreateCustomers(TComponent *Owner, AnsiString Caprion);
ore you mean thet the parrameter is supposed to be a pointer?
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: Overload DllExperted function

 
0
  #6
Oct 27th, 2008
Look at how printf is called with varying numbers of parameters.
In order to make sense of it all, you look at the first parameter.

It's about as close to overloading as you're going to get in C, without something really horrible and messy.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 25
Reputation: uim_1977 is an unknown quantity at this point 
Solved Threads: 0
uim_1977 uim_1977 is offline Offline
Light Poster

Re: Overload DllExperted function

 
0
  #7
Oct 27th, 2008
Why don't you just give me simple, why you are trying to make me work so hard ? I do like to find ansfers by myself but i'm so tired today, i spand all night fighting with. please give me the ansfer for the problem.
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: Overload DllExperted function

 
0
  #8
Oct 27th, 2008
There is no "simple".
Fundamentally, there is no overloading in C - period.
There's just a bunch of hacks which could loosely be described as "good", "bad" and "ugly".

Since you've given minimal information (like are you even allowed to change the C code?), it's just vague suggestions based on what might be possible.


Oh, and get some sleep. As often as not, I find the answer to be so obvious in the morning I wondered what the hell the problem was the night before that I couldn't see it.

See you in the morning, cos I'm about done for the night as well.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 25
Reputation: uim_1977 is an unknown quantity at this point 
Solved Threads: 0
uim_1977 uim_1977 is offline Offline
Light Poster

Re: Overload DllExperted function

 
0
  #9
Oct 27th, 2008
Thanks, man!!!
It's only 3PM in colorado, so got 2 hours more to work
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC