OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Basic String / C++ dll

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
Gastiflex
Power User
Power User


Joined: 29 Mar 2006
Posts: 70
Location: Toulouse - France

PostPosted: Tue Apr 04, 2006 7:14 am    Post subject: Basic String / C++ dll Reply with quote

Hi,
In a OOo macro, I have to call a C++ dll. I have to send a String from the macro to the dll, but it seems that Basic strings are not compatible with the char* C++ type.
Does anybody know how can I do the conversion (in my macro or in my C++ program) ?
Thank you.
Back to top
View user's profile Send private message
SergeM
Super User
Super User


Joined: 09 Sep 2003
Posts: 3211
Location: Troyes France

PostPosted: Tue Apr 04, 2006 8:52 am    Post subject: Reply with quote

And what about the dll : have you the code source ?
_________________
Linux & Windows OOo3.0
UNO & C++ : WIKI
http://wiki.services.openoffice.org/wiki/Using_Cpp_with_the_OOo_SDK
In French
http://wiki.services.openoffice.org/wiki/Documentation/FR/Cpp_Guide
Back to top
View user's profile Send private message Visit poster's website
Gastiflex
Power User
Power User


Joined: 29 Mar 2006
Posts: 70
Location: Toulouse - France

PostPosted: Wed Apr 05, 2006 1:18 am    Post subject: Reply with quote

Yes, I can modify and re-compile the dll source.
The other problem I have is when I try to send an array from basic to the dll.
In basic I send a Long array and in C++ I catch Int array (so the element's size matches between basic and C++).
The sending of the first element of the array works (I check that the addresses of the first element in basic and in C++ are the same), but the I can't get the others elements.
I think the memory allocation in basic in not the same that in C++, but I don't know how to solve this (except by writing the array in a file).
Back to top
View user's profile Send private message
SergeM
Super User
Super User


Joined: 09 Sep 2003
Posts: 3211
Location: Troyes France

PostPosted: Wed Apr 05, 2006 9:05 am    Post subject: Reply with quote

You can use OUString in your C++ dll. See http://perso.wanadoo.fr/moutou/MyUNODoc_HTML/UNOCppAPI3.html where the problem of string is tackled. I think that OOobasic furnish a OUString and you can convert it in what you want and call your sub. Note that if you use OUString you will use a dll (cppuhelper.dll I think)
_________________
Linux & Windows OOo3.0
UNO & C++ : WIKI
http://wiki.services.openoffice.org/wiki/Using_Cpp_with_the_OOo_SDK
In French
http://wiki.services.openoffice.org/wiki/Documentation/FR/Cpp_Guide
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group