Developing DLLs with FBC?

Windows specific questions.
Site Admin
Posts: 3594
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada

Re: Developing DLLs with FBC?

Postby coderJeff » Aug 02, 2021 10:58

Moved to Platforms | Windows
Posts: 63
Joined: Sep 19, 2005 9:50

Re: Developing DLLs with FBC?

Postby Vortex » Aug 07, 2021 7:26

Hi dodicat,

Here is a modified version of your example :

Code: Select all


'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 (a As Long) As Long Export
    Return sum
End Function

Sub udt.disp(a As Long) Export

Print a

End Sub

End Extern

Code: Select all

// udt2.cpp

#include <stdio.h>

struct udt
int sum;
int plus(int a);
void disp(int a);

int main()
   udt u;

// command line:
//g++ Udt2.cpp -o Udt2.exe -L. -l udttest -mconsole

The trick is that the decoration of the symbols should match on both sides, the DLL and the client :

The symbols from udttest.o :

Code: Select all


GCC and MSVC C++ Demangler :

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 : ... vu53b0r4mp

Return to “Windows”

Who is online

Users browsing this forum: No registered users and 2 guests