473,387 Members | 1,575 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,387 software developers and data experts.

Calling DLL - Parameters not being sent over?

Hello,

could someone please help me out, i'm trying to call a Delphi 6.0 custom DLL
from inside of a C# windows project.
i use the following declaration:

[DllImport("calwin.dll", EntryPoint="CalcWindow",
ExactSpelling=false,CallingConvention=CallingConve ntion.StdCall )]
static extern double CalcWindow(long OrderNum22, long WinNum22);

The problem is that the second parameter WinNum22 is always 0 on the DLL
side? the first parameter is passed ok, but not the second one, what am i
doing wrong?

The delphi 6.0 code is as follows:
function CalcWindow(OrderNum:longint; WinNum: longint): double; stdcall;
Implementation
function CalcWindow(OrderNum:longint; WinNum: longint): double;

in the project source file, i export the dll like this:

exports
CalcWindow name 'CalcWindow';

Thanks.

Nov 16 '05 #1
1 1360
In .NET, a long is 64 bits longint in delphi is 32 bit, so you should pass
int's.

Willy.

"ARTMIC" <AR****@discussions.microsoft.com> wrote in message
news:11**********************************@microsof t.com...
Hello,

could someone please help me out, i'm trying to call a Delphi 6.0 custom
DLL
from inside of a C# windows project.
i use the following declaration:

[DllImport("calwin.dll", EntryPoint="CalcWindow",
ExactSpelling=false,CallingConvention=CallingConve ntion.StdCall )]
static extern double CalcWindow(long OrderNum22, long WinNum22);

The problem is that the second parameter WinNum22 is always 0 on the DLL
side? the first parameter is passed ok, but not the second one, what am i
doing wrong?

The delphi 6.0 code is as follows:
function CalcWindow(OrderNum:longint; WinNum: longint): double; stdcall;
Implementation
function CalcWindow(OrderNum:longint; WinNum: longint): double;

in the project source file, i export the dll like this:

exports
CalcWindow name 'CalcWindow';

Thanks.

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: dw | last post by:
Hello all, I'm having a dickens of a time calling a stored procedure on a connection. Every time I do, it generates an error "Arguments are of the wrong type, are out of acceptable range, or are in...
1
by: Tony B | last post by:
Hi, I'm trying to call a webservice written in .NET that takes some parameters. I can get it working on a machine with php5 but when I try to call the function from machine using php4 and...
18
by: Simula | last post by:
I am developing an HTML javascript application and I want to preserve state in a way that can be book-marked. I chose HTML anchors as a means of preserving state. When the application changes...
5
by: Dave | last post by:
does calling a regular function cost any cpu time? In other words, is it faster to write the code of two functions into main(), or is it the exact same thing as calling two functions. I know its...
19
by: LP | last post by:
I am using (trying to) CR version XI, cascading parameters feature works it asks user to enter params. But if page is resubmitted. It prompts for params again. I did set...
0
by: Cleo | last post by:
Hi, I am trying to call a WebService Method written in Weblogic from VB.NET and I am getting the following error. I am using SOAP Caal s from VB.NET. Please find the wsdl file and my code. ...
6
by: Scott McNair | last post by:
Hi all, I'm having problems calling a stored procedure from within my code. If I execute the SP manually from a Query Analyzer window it runs without a hitch, but it seems it doesn't even fire...
8
by: Duffcase | last post by:
Hi. I'm having some problems consuming a webservice. The server keeps complaining about the wrong element beeing sent.. I have this method that takes two strings String_1 and String_2 The...
18
by: John Friedland | last post by:
My problem: I need to call (from C code) an arbitrary C library function, but I don't know until runtime what the function name is, how many parameters are required, and what the parameters are. I...
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:
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.