Code: Select all
*MyString.vstring [...]
Code: Select all
*MyString.vstring [...]
Code: Select all
strng$ = "some string"
*mystruct.type = getString(@strng$)
result$ = PeekS(returnString(*mystruct))
Code: Select all
/manifestdependency:"type='win32' name='Microsoft.VC80.CRT' version='8.0.50608.0' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b'"
Code: Select all
struct lib_struct
{
int type;
char* f;
};
extern "C" struct lib_struct* getString(char* string)
{
static struct lib_struct foo;
foo.f = string;
foo.type = strlen(string);
return(&foo);
}
extern "C" char* returnString(struct lib_struct* str)
{
return(str->f);
}
Code: Select all
ImportC "mylib.lib"
getString.l(string.s)
returnString.l(struct.l)
EndImport
Structure lib_struct
type.l
f.l
EndStructure
*mystruct.lib_struct = getString("foo")
result$ = PeekS(returnString(*mystruct))
Debug result$
Code: Select all
ImportC "mylib.lib"
getString.l(string.s)
returnString.l(struct.l)
EndImport
Structure lib_struct
type.l
f.l
EndStructure
ProcedureCDLL.lib_struct parseString( *foo.lib_struct )
str$ = returnString(*foo)
ProcedureReturn getString(str$)
EndProcedure
Code: Select all
Structure mystruct
a.l
b.l
EndStructure
ProcedureCDLL.l blah(*str.mystruct)
ProcedureReturn *str
EndProcedure
Define.mystruct a_struct
a_struct\a = 23
a_struct\b = 69
*aaa.mystruct = blah(@a_struct)
Debug Str(*aaa\a)
Debug Str(*aaa\b)
See above - you return a .l but just use it as a pointer to the type in question. If you're calling this DLL from e.g. C then you just define the return type in the header file as a pointer to the type you need e.g.:be structs. I can cope with being able to pass pointers only, as I can always pass the values back into a generic C dll for conversion, but I don't know how to do this, either.
Code: Select all
struct mystruct
{
long a;
long b;
};
/* Or some variant of this, I can never remeber the ordering of declspecs */
__declspec(dllimport) struct mystruct* __cdecl blah(struct mystruct* str);
Code: Select all
ProcedureCDLL.l blah(str.mystruct)
ProcedureReturn str
EndProcedure
Code: Select all
ProcedureCDLL.l blah(*str.mystruct)
ProcedureReturn *str
EndProcedure