Thank you for your answer.
I actually tried the data types we use int, double,
Variant_Bool. They
work fine. We do not use VARIANT or SAFEARRAY to limit
porting effort to
other platforms.
The String type does not work correctly. Do you use a BSTR
in Unicode
character set? Where can I find information about the string
data type
used in ooBasic? Is there an example in the OpenOffice
documentation about
the use of the string type during library calls?
What would be a simple example of ?functions in one
IDispatch object??
The examples with IDispatch in the openOffice documentation
and
development kit are using the syntax like
mgr = getProcessServiceManager()
o =
mgr.createInstance("org.openoffice.sheet.addin.RNG"
;)
from the simple Calc Addin Example
(http://wiki.services.openoffice.org/wiki/
Calc/Add-In/Simple_Calc_Add-In)
How would the IDL with one dispatch object like in my case.
Thanks in advance for your help.
Jürgen
Joachim Lingner <joachim.lingner sun.com> wrote on
10/17/2007 08:53:29 AM:
> I have no idea what the limits are regarding calling
functions directly
> from OOo Basic. However, this would probably only work
with argument
> types which are similar to UNO types. In other words,
if a function
> takes VARIANTs then this will not work. There is the
possibility of
> calling automation objects from OOo Basic. That is, you
could put all
> your functions in one IDispatch object and use it then
from Basic.
>
> I think there was still a problem with multidimensional
arrays. Apart
> from that this could work.
>
> Joachim
>
> jjaeger xlstat.com schrieb:
> > Thank you for your help.
> >
> > Is it possible to port the example using the
OLE/COM Uno bridge and
still
> > having the call in ooBasic of the function
unchanged like
> >
> > Outval = fplus( inval)
> >
> > This would at least limit the changes to do the
vba code during the
port
> > to OpenOffice.
> >
> > Is there another way than using the VBA statement
Declare Function Lib
to
> > declare C++ functions in ooBasic. I will have to
port over 200.
>
>
>
>
> >
> > Regards
> >
> > Jürgen
> >
> > Joachim Lingner <joachim.lingner sun.com> wrote on 10/15/2007 04:49:53
PM:
> >
> >> Importing a type library is not supported.
> >>
> >> Joachim
> >>
> >> jjaeger xlstat.com wrote:
> >>> Hello,
> >>>
> >>> I am porting a C++ COM application that is
called from Excel via VBA
> > to
> >>> application that is called from Calc via
ooBasic.
> >>>
> >>> I am new to the OpenOffice environment and
have some basic questions
> > to
> >>> learn the way ooBasic uses the OLE/COM Uno
bridge.
> >>>
> >>> Here is my C++ example:
> >>>
> >>> MYSHAREDLIB_API double __stdcall fplus
(double invalue)
> >>> {
> >>> return invalue + 1.0;
> >>> }
> >>>
> >>> And here the type library file .odl:
> >>>
> >>> import "oaidl.idl";
> >>> import "ocidl.idl";
> >>> [
> >>>
uuid(7D4B1C8E-69AF-4082-90CF-E07FD904A4DA),
> >>>
helpstring("MySharedLib"),
> >>> lcid(0x0409),
> >>> version(1.5)
> >>> ]
> >>> library MySharedLib
> >>> {
> >>> [
> >>> helpstring("Functions
exported by MySharedLib.dll"),
> >>> version(1.5),
> >>>
dllname("MySharedLib.dll")
> >>> ]
> >>> module MSL
> >>> {
> >>> [
helpstring("fplus"), entry("fplus") ]
> > double
> >>> fplus( [in] double invalue );
> >>> }
> >>> }
> >>>
> >>> I can call this .dll in Calc using the VBA
equivalent of Declare
> > Function
> >>> Declare Function fplus Lib
?MySharedLib.dll? (ByVal invalue as
> > Double) as
> >>> Double
> >>>
> >>> With a call example like this in the
ooBasic code
> >>>
> >>> Outval = fplus( inval)
> >>>
> >>> How can I import the information about
fplus using the type library
> > .tlb ?
> >>> In Excel I can use the Tools ->
References? Menu to add the
> > typelibrary
> >>> information to my Excel vba code as a
reference.
> >>>
> >>>
> >>>
> >>>
> >>> Regards
> >>>
> >>> JJ
> >>
------------------------------------------------------------
---------
> >> To unsubscribe, e-mail: dev-unsubscribe udk.openoffice.org
> >> For additional commands, e-mail: dev-help udk.openoffice.org
> >>
> >>
> >
>
>
------------------------------------------------------------
---------
> To unsubscribe, e-mail: dev-unsubscribe udk.openoffice.org
> For additional commands, e-mail: dev-help udk.openoffice.org
>
>
|