943,769 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 543
  • C++ RSS
Oct 27th, 2008
0

Overload DllExperted function

Expand Post »
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 ?
C++ Syntax (Toggle Plain Text)
  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

C++ Syntax (Toggle Plain Text)
  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
Reputation Points: 46
Solved Threads: 0
Light Poster
uim_1977 is offline Offline
25 posts
since Oct 2008
Oct 27th, 2008
0

Re: Overload DllExperted function

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.
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005
Oct 27th, 2008
0

Re: Overload DllExperted function

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?
Reputation Points: 46
Solved Threads: 0
Light Poster
uim_1977 is offline Offline
25 posts
since Oct 2008
Oct 27th, 2008
0

Re: Overload DllExperted function

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
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005
Oct 27th, 2008
0

Re: Overload DllExperted function

I'm sorry but i'm not experianced enoff to figer it out, did not i've done it in
Quote ...
extern "C" __declspec(dllexport) __stdcall void CreateCustomers(TComponent *Owner, AnsiString Caprion);
ore you mean thet the parrameter is supposed to be a pointer?
Reputation Points: 46
Solved Threads: 0
Light Poster
uim_1977 is offline Offline
25 posts
since Oct 2008
Oct 27th, 2008
0

Re: Overload DllExperted function

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.
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005
Oct 27th, 2008
0

Re: Overload DllExperted function

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.
Reputation Points: 46
Solved Threads: 0
Light Poster
uim_1977 is offline Offline
25 posts
since Oct 2008
Oct 27th, 2008
0

Re: Overload DllExperted function

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.
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005
Oct 27th, 2008
0

Re: Overload DllExperted function

Thanks, man!!!
It's only 3PM in colorado, so got 2 hours more to work
Reputation Points: 46
Solved Threads: 0
Light Poster
uim_1977 is offline Offline
25 posts
since Oct 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: winsock yahoo.com
Next Thread in C++ Forum Timeline: Test Casing





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC