Returning Structure from C++ DLL

Advanced game related topics
Uf
New User
New User
Posts: 9
Joined: Fri May 09, 2003 11:57 am

Returning Structure from C++ DLL

Post by Uf »

How can I return structure from other DLL made in C++?
example:

Code: Select all

Structure 
   a.l
   b.l
   c.l
   d.l
EndStructure


OpenLIbrary(0,"etc.dll")

Number CallFunction(0,"myfunc",33,44,77,11)


and to return data in my structure?
[/code]
WolfgangS
Enthusiast
Enthusiast
Posts: 174
Joined: Fri Apr 25, 2003 3:30 pm

Post by WolfgangS »

Hi
I can tell you how to receive an element of a STRUCTURE from a (normal) procedure or libraray (i believe) it´s the same like from a c++ Method:

You need the STRUCTURE of the STRUCTRE o_O ...
Without the information about the STRUCTURE you will get back it isn´t possible to do it.

Code: Select all

STRUCTURE johnstructure
  a.l
  b.l
  c.l
ENDSTRUCTURE
You will receive a pointer to the element this way: (You ALSO have to tell PB the STRUCTURE of it)
This way:
It means PB creates a NEW element when you have called the procedure/method/whatever

Code: Select all

*myelement.johnstructure=CallFunction(foo)
If you try to modify the content of this element:

Code: Select all

*myelement\a=1
*myelement\b=1
Or if you want to read it:

Code: Select all

debug *myelement\c
You also can give THIS element to a further procedure/library/whatever:

Code: Select all

myprocedure(*myelement)
Please also note: to call a procedure/method/whatever with A NEW element works this way:

Code: Select all

newelement.johnstructure
MySuperFunction (@newelement)

I hope this is what you need.

MFG
WolfgangS

PS: If you know how to call a c++ Method successfully let me know !!
Uf
New User
New User
Posts: 9
Joined: Fri May 09, 2003 11:57 am

Post by Uf »

Thanx man, I'll do some work about this.
Post Reply