|
-
September 5th, 2001, 03:49 PM
#1
passing a string to a c++ dll
hi i need to pass a string for output in a dll function defined like this
GenerateLicenceID(CString sBaseID, int duration, CString *sLicenceID);
and in the VB it is defined like this
Public Declare Function GenerateLicenceID Lib "C:\Final\bin\vproc.dll" Alias "?GenerateLicenceID@@YAXVCString@@HPAV1@@Z" (ByVal sBaseID As String, ByVal duration As Integer, ByRef sLicenceID As String)
but i get memory error and the program terminates
-
September 5th, 2001, 07:36 PM
#2
Re: passing a string to a c++ dll
when U R using an API DLL the option byval/byref has another meaning.. so to pass a string U maust use byval... also for your concepts is byref...
so tru this code..
'GenerateLicenceID(const char* sBaseID, int duration, Char *sLicenceID);
'it is not define return type.. so defaul is int and not void... but it is necessary the __stdcall option to export as API...
public Declare Function GenerateLicenceID Lib "C:\Final\bin\vproc.dll" Alias "?GenerateLicenceID@@YAXVCString@@HPAV1@@Z" (byval sBaseID as string, byval duration as Integer, byval sLicenceID as string) as integer
public sub prova
dim sbaseid as string
dim duration as integer
dim slicenceid as string*255
'...code...
slicenceid=string(255,0)
debug.print GenerateLicenceID(sbaseid,duration,slicenceid)
debug.print slicenceid
end sub
<center>
<HR width=80%>
<img src='http://web.tiscali.it/bertaplanet/im...ertaplanet.gif'>
</center>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|