Developing DLLs with FBC?
Re: Developing DLLs with FBC?
Moved to Platforms | Windows
Re: Developing DLLs with FBC?
Hi dodicat,
Here is a modified version of your example :
The trick is that the decoration of the symbols should match on both sides, the DLL and the client :
The symbols from udttest.o :
GCC and MSVC C++ Demangler :
https://demangler.com/
The sample above is compiled as 64-bit code.
Attachment :
https://we.tl/t-DWllzZc7BC
https://virusscan.jotti.org/en-US/files ... vu53b0r4mp
Here is a modified version of your example :
Code: Select all
'udttest.bas
'compile with -dll to get udttest.dll
Extern "C++"
Type udt
As Long sum
Declare Function plus (As Long) As Long
Declare Sub disp(As Long)
End Type
Function udt.plus (a As Long) As Long Export
sum=sum+a
Return sum
End Function
Sub udt.disp(a As Long) Export
Print a
End Sub
End Extern
Code: Select all
// udt2.cpp
#include<stdlib.h>
#include <stdio.h>
struct udt
{
int sum;
int plus(int a);
void disp(int a);
};
int main()
{
udt u;
u.sum=12;
u.disp(u.sum);
printf("%d\n",u.plus(8));
system("pause");
}
// command line:
//g++ Udt2.cpp -o Udt2.exe -L. -l udttest -mconsole
The symbols from udttest.o :
Code: Select all
_ZN3udt4plusEi
_ZN3udt4dispEi
Code: Select all
public _ZN3udt4plusEi
public _ZN3udt4dispEi
Demangled symbols :
public udt::plus(int)
public udt::disp(int)
The sample above is compiled as 64-bit code.
Attachment :
https://we.tl/t-DWllzZc7BC
https://virusscan.jotti.org/en-US/files ... vu53b0r4mp