Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > BOOK: Ivor Horton's Beginning Visual C++ 2010
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Ivor Horton's Beginning Visual C++ 2010
This is the forum to discuss the Wrox book Ivor Horton's Beginning Visual C++ 2010 by Ivor Horton; ISBN: 9780470500880
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Ivor Horton's Beginning Visual C++ 2010 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old April 30th, 2014, 09:32 AM
Registered User
Points: 13, Level: 1
Points: 13, Level: 1 Points: 13, Level: 1 Points: 13, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2013
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default pass string back from dll (c++) to application (vb.exe) for x64 platforms

my dll is and needs to be x64. I have in the past passed reference strings to a dll x32 but when I try to do the same thing it doesn't work.

more explicitly my vb declare is:

Declare Sub stringbyref_ Lib "c:\davids\directory_all_dlls\hiprec1.dll" (s As String)


and my c++ dll function is:

void FAR PASCAL stringbyref_(LPSTR*p_s)

{



}


when the code is run p_s is a bad pointer!

I note that I can pass a string forward into the dll just fine. its the passback that is the problem.

if you can help I would appreciate it.
  #2 (permalink)  
Old April 30th, 2014, 05:06 PM
Registered User
Points: 13, Level: 1
Points: 13, Level: 1 Points: 13, Level: 1 Points: 13, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2013
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default my error

my error! I apologize. it works as advertised.

the declaration that works in the dll is:

void FAR PASCAL stringbyref_(LPSTR p_s)

{

}

and the calling declaration from vb is:

Declare Sub stringbyref_ Lib "c:\davids\directory_all_dlls\hiprec1.dll" (s As String)

note that:

Declare Sub stringbyref_ Lib "c:\davids\directory_all_dlls\hiprec1.dll" (byref s As String)

crashes when returning from the dll.

sorry for inconvience,


david
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
VB.NET On Other Platforms neogortex Pro Visual Basic 2005 1 June 12th, 2006 02:48 PM
VB dll/exe version compatibility pinkuisadear VB Components 8 July 20th, 2005 01:14 PM
How to Pass a UDT from ATL to VB via COM-EXE-SERVE polderudo C++ Programming 3 April 21st, 2005 08:57 AM
Urgent! How to make vb application to .exe? snowydust VB How-To 3 August 10th, 2004 12:25 PM
Pass active X control from c++ to VB DLL rraags Visual C++ 2 June 8th, 2004 03:28 PM



All times are GMT -4. The time now is 02:04 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.