Hi,
I'm using PHP 4.3.3 in CLI on Win XP SP1. I use the _experimental_
w32api. It seems to work quite fine yet I cannot pass a string argument
to any of my dll functions :
1) Load the w32api extension :
if (!dl("php_w32ap i.dll")) {
echo "Erreur : Impossible de chager le module php_w32api
(php_w32api.dll ).";
exit;
}
2) Register the dll functions into the win32 class
$api = new win32;
$api->registerfuncti on("int CIALArtPrixClie nt(string AR_Ref,string
CT_NUM,int C
atTarif,int AG_NO1,int AG_NO2,double &RESULTAT) From cbodbc32.dll");
3) Call the function
$ar_ref="XVIS";
$ct_num="OPALE" ;
$ess->api->CIALArtPrixCli ent($ar_ref, $ct_num,2,0,0,$ a);
The CIALArtPrixClie nt function is meant to retrieve the price of the
article 'AR_Ref' for the client 'CT_NUM' from a database. AG_NO1 and
AG_NO2 are to be ignored as they are numeric constants (I managed to
pass decimal values to some other functions). The last argument,
RESULTAT, is a reference to a double where to store the result (it also
works fine with another function).
When I try to run this code, the PHP script engine crashes (ending up
with a nice winxp 'send report' msgbox).
Does someone have any idea about how to pass a string as argument to a
dll exported function ?
Regards,
Mohamed Rambil 2 1731 I'm using PHP 4.3.3 in CLI on Win XP SP1. I use the _experimental_ w32api. It seems to work quite fine yet I cannot pass a string argument to any of my dll functions :
$api = new win32; $api->registerfuncti on("int CIALArtPrixClie nt(string AR_Ref,string CT_NUM,int C atTarif,int AG_NO1,int AG_NO2,double &RESULTAT) From cbodbc32.dll");
The manual notes that support for these functions is no longer
guaranteed. However, this quick test works OK on 4.3.4:
dl("php_w32api. dll");
$api = new win32;
$api->registerfuncti on("long sndPlaySound (string a, int b) From
winmm.dll");
$api->sndPlaySound(" c:\winnt\media\ The Microsoft Sound.wav", 0);
I'd just suggest checking the argument names and types for the DLL
function very carefully as I doubt you will get much help from PHP if
there are any errors.
---
Steve
Hi,
In fact the example you give works. Must be a type mismatch between
the PHP value and the DLL one or maybe a type size mismatch.
Anyway, thanks a lot
--
Mohamed This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Alex Vinokur |
last post by:
Various forms of argument passing
=================================
C/C++ Performance Tests
=======================
Using C/C++ Program Perfometer
http://sourceforge.net/projects/cpp-perfometer
http://alexvn.freeservers.com/s1/perfometer.html
|
by: kazack |
last post by:
I am a little confused with code I am looking at. My c++ book does not go
into passing a structure to a function so I pulled out a c book which does.
and I do not understand the prototype verses the actual function call. I
will post the code below of the structure, the prototype and and function
call and if someone can explain this I would be very appreciative:
struct data
{
float amount;
string fname;
|
by: domeceo |
last post by:
can anyone tell me why I cannot pass values in a setTimeout function
whenever I use this function it says "menu is undefined" after th
alert.
function imgOff(menu, num) {
if (document.images) {
document.images.src = eval("mt" +menu+ ".src")
}
alert("imgOff_hidemenu");
hideMenu=setTimeout('Hide(menu,num)',500);
|
by: Victor Bazarov |
last post by:
In the project I'm maintaining I've seen two distinct techniques used for
returning an object from a function. One is
AType function(AType const& arg)
{
AType retval(arg); // or default construction and then..
// some other processing and/or changing 'retval'
return retval;
}
|
by: B Squared |
last post by:
I'm trying to pass a string from the current html page to one I'm
calling. I've read (in the O'Reilly text) this involves using "?",
but there's no example. For example, given I have a standard href
in my code
<a href="new_page.php" (string_I_want_to_pass)>
What is the syntax for passing the string? The new page is html
with some php imbedded, and I'll want to use the string I pass
inside the php code, but that might be a separate...
| |
by: sd2004 |
last post by:
I am still learning, could someone
show/explain to me how to fix the error.
I can see it is being wrong but do not know how to fix.
could you also recommend a book that I can ref. to ?
////////////////// ERROR MESSAGE /////////////////////
bash-2.05b$ g++ test5c.cpp
test5c.cpp: In function `int main()':
test5c.cpp:36: error: invalid initialization of reference of type
|
by: Boris |
last post by:
The PHP documentation at http://www.php.net/manual/en/ref.w32api.php says
that W32api has been moved to the PECL repository and is no longer bundled
with PHP as of PHP 5.1.0. After I finally found out that W32api is now
called or replaced by ffi (why isn't that mentioned in the documentation?) I
downloaded php_ffi.dll directly from
http://pecl4win.php.net/ext.php/php_ffi.dll. When you try to load this
extension in PHP 5.1.2 though you get...
|
by: Andy Baker |
last post by:
I am attempting to write a .NET wrapper for a C++ DLL file, but am having
problems with passing strings as parameters. How should I be writing my C#
function call when the C header file is definined as taking a char * as an
argument? For example the C++ header says
SDCERR GetCurrentConfig(DWORD *num, char *name);
I am using Uint for the *num parameter, which returns the correct value
but for *name, I always get back a string of 6 squares....
|
by: sanjay |
last post by:
Hi,
I have a doubt about passing values to a function accepting string.
======================================
#include <iostream>
using namespace std;
int main()
{
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |