How to write c++ to call a FreeBasic dll

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

How to write c++ to call a FreeBasic dll

Post by chrisc »

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: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

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

Post by MrSwiss »

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
Moderator
Posts: 1733
Joined: Jul 25, 2017 17:22
Location: Argentina

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

Post by paul doe »

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?
Post Reply