Re: GetProcAddress in Delphi .net 2005



Marc,

The basic problem is the requirement to allow for Multiple tax calculation
options.
So the have an object that works out Tax under differnt circomstances, now
based on what you want you load a taxDll. This will override some (or all)
of the calculations.
So you pre-define a number of procedures you expect in the taxdll.
Some Dlls have only a few, some have all.
In the end the user can select (Buy) a paritcular taxdll.

I used the meganism before (Before .net). Works well.

I now use the VLI option, works well, just have an interface for each
Calculation.

So for a new TaxLib name you get somthing like..


If Supports(fLibName, TypeOf(ICalcProfit), fCalcProfit) Then
Else fCalcProfit := Nil;

And further down..



Procedure TTaxLib.CalcProfit (Cost : Currency;
CostTaxID : Integer;
Sell : Currency;
SellTaxID : Integer;
Var ProfitD : Currency;
Var ProfitP : Double);

Begin
If Assigned(fCalcProfit) Then Begin
fCalcProfit.CalcProfit(Cost,CostTaxID,Sell,SellTaxID,ProfitD,ProfitP)
End Else Begin
ProfitD := Sell - Cost;
.........



By the way the name is Dutch, so is 'Niew Zeeland'



"Marc Rohloff" <marcrohloff_ng@xxxxxxxxxxx> wrote in message
news:1114695085.150679.231990@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>
> Andre Joosten wrote:
>> I did find you can't use getprocaddress direct.. need to use a
> delegate
>> But i can not find (much) on how to do that...
>
> Can't you convert the libraries to .NET assemblies or alternatively to
> COM objects? What sort of security settings do you need to run under.
> Are you ever going to load more than one DLL in a session? Is the name
> of the DLL and the exported function always the same?
> I know of 3 ways to do this, they all have their pros and cons.
>
> Generally this technique is typically called Dynamic PInvoke. A search
> should get you a few hits. This is the first:
> http://www.msnewsgroups.net/group/microsoft.public.dotnet.languages.csharp/topic740.aspx
>
> 'Joosten'? This isn't a typical NZ name is it?
>
> --
> Marc Rohloff
>


.



Relevant Pages

  • Re: C# vs C
    ... I have a calculation library written in C compiled into a DLL. ... This would require marshalling of some structs etc ... but I am worried that the .NET implementation ...
    (microsoft.public.dotnet.framework.performance)
  • Re: How to stop a BackgroundWorker thread that calls a C++ dll
    ... calculation. ... But based on Mehdi's feedback I think that I will try to find a way to ... My interface calls a C++ dll that runs a slow calculations. ... dll to stop so CancelAsync() will not work? ...
    (microsoft.public.dotnet.languages.csharp)
  • slow DLL call problem
    ... The main excutable used to have some calculation functions, ... time consuming of original calculation from the excutable versus the ... calculation through this new DLL, the DLL calls is much slower. ...
    (microsoft.public.vstudio.development)
  • Re: Secure DLL
    ... > Does somebody know a secure solution to ensure that the DLL an application ... the application sends a "challenge" message to the DLL. ... > responds with a value calculated using a one-way hash function. ... > application checks the response against its own calculation of the expected ...
    (comp.security.misc)