How to write c++ to call a FreeBasic dll

New to FreeBASIC? Post your questions here.
chrisc
Posts: 10
Joined: Dec 04, 2016 18:59

How to write c++ to call a FreeBasic dll

Postby chrisc » Sep 21, 2018 13:52

Hello all

i'm looking for a c++ code that can call a Freebasic dll and retrive a string from
that Freebasic dll.

how to write this c++ code and the Freebasic dll ?

all help appreciated and thanxx in advance
MrSwiss
Posts: 2817
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: How to write c++ to call a FreeBasic dll

Postby MrSwiss » Sep 21, 2018 19:03

Can't help with the C++ stuff, however, below the FB code for a FB.dll,
which outputs a cString Ptr (declared extern "C++") ...

Compile with -dll compiler switch (see: FB documentation):

Code: Select all

Extern "C++"
/'
    This procedure uses the CDECL convention and its name is mangled
    compatible to g++-4.x (see C++ documentation)
'/

Function _time_() As Const ZString Ptr Export
    Static As ZString * 9   sTime       ' 8 byte Time + chr(0)

    If sTime <> Time Then sTime = Time  ' update if needed

    Return @sTime
End Function

End Extern

Better ask C++ related questions in another Forum (mixed language, or C++ specific).
paul doe
Posts: 804
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: How to write c++ to call a FreeBasic dll

Postby paul doe » Sep 21, 2018 19:37

chrisc wrote:...
how to write this c++ code and the Freebasic dll ?

all help appreciated and thanxx in advance

What would be the purpose of this? Just interfacing to C++ via strings?

Return to “Beginners”

Who is online

Users browsing this forum: No registered users and 5 guests