PlanetSquires Forums

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Compiling Win64 Windows DLL  (Read 274 times)

Dennis Hoskins

  • Little Newbie
  • *
  • Posts: 12
  • FF3 User
Compiling Win64 Windows DLL
« on: May 18, 2020, 11:39:52 PM »

Paul,

I am trying to compile a 64-bit windows dll. I copied the following from the FB manual:

Code: [Select]
'' mylib.bas
'' compile with: fbc -dll mylib.bas

'' Add two numbers together and return the result
Public Function Add2( ByVal x As Integer, ByVal y As Integer ) As Integer Export
  Return( x + y )
End Function

When I compile, I get 1 error but no indication of the error:

The compiler command line is:

The build configuration is:

I have tried with -s console and without.

Any suggestions to find the error?

Thank you,

Dennis
« Last Edit: May 18, 2020, 11:43:24 PM by Dennis Hoskins »
Logged

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 9287
  • Windows 10
    • PlanetSquires Software
Re: Compiling Win64 Windows DLL
« Reply #1 on: May 19, 2020, 08:34:39 AM »

Hi Dennis, that's odd because it worked perfectly for me on the first shot. Here is all I did:

- Start WinFBE64
- New file (saved it as testdll.bas)
- Pasted in your code from your post above.
- Selected "Win64 Windows DLL" from the droplist in the top toolbar.
- Pressed compile.

It produced a 20K dll.

Can somebody else here try this test to see if they run intot he same issue as Dennis has?

 
Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 9287
  • Windows 10
    • PlanetSquires Software
Re: Compiling Win64 Windows DLL
« Reply #2 on: May 19, 2020, 08:35:58 AM »

Also, are regular EXE type of programs compiling for you in both 32 and 64 bit? Is it only the DLL's that are showing this problem?
Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

raymw

  • Senior Member
  • ***
  • Posts: 394
Re: Compiling Win64 Windows DLL
« Reply #3 on: May 19, 2020, 09:48:25 AM »

Hi Dennis, that's odd because it worked perfectly for me on the first shot. Here is all I did:

- Start WinFBE64
- New file (saved it as testdll.bas)
- Pasted in your code from your post above.
- Selected "Win64 Windows DLL" from the droplist in the top toolbar.
- Pressed compile.

It produced a 20K dll.

Can somebody else here try this test to see if they run intot he same issue as Dennis has?



did the same for me - got 20Kdll  (and i've never created one b4)
Logged

Joerg Buckel

  • Junior Member
  • **
  • Posts: 104
  • FF3 and WinFBE+WinFBX User
Re: Compiling Win64 Windows DLL
« Reply #4 on: May 19, 2020, 10:11:51 AM »

Hello Dennis

I can't confirm your mistake, too.
My result is concruent with Paul and raymw.
Logged
Greeting from Germany

Joerg

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 9287
  • Windows 10
    • PlanetSquires Software
Re: Compiling Win64 Windows DLL
« Reply #5 on: May 19, 2020, 10:23:29 AM »

It "could be" related to the fact that you have WinFBE installed into a folder that has a space in it (WinFBE Suite vs. WinFBE_Suite). This has caused problems in the past with the interaction between CreateProcess and GCC. I check for embedded spaces folder paths (even enclosing the path in double quotes doesn't seem to help) and then use an alternate compile process via batch files. Try moving your installation to a folder without spaces to see if that is the problem. It's worth a shot.
Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Dennis Hoskins

  • Little Newbie
  • *
  • Posts: 12
  • FF3 User
Re: Compiling Win64 Windows DLL
« Reply #6 on: May 19, 2020, 10:25:19 AM »

I haven't used WinFBE much at all in the past, but in previous versions I have compiled some of the example programs without problem. To install I copy the files from the .rar file to C:\Software\WinFBE Suite.

I tried to compile the following code from powershell
Code: [Select]
Print "Hello World"
Print "Press any key ..."
Input(1)
with the following result:
Quote
PS C:\Software\WinFBE Suite\FreeBASIC-1.07.1-gcc-5.2> .\fbc64.exe  -m "C:\Users\dgh\Documents\Programming\FreeBasic\test\test1.bas" -v -s console  -x "C:\Users\dgh\Documents\Programming\FreeBasic\test\test1.exe" 
FreeBASIC Compiler - Version 1.07.1 (2019-09-27), built for win64 (64bit)
Copyright (C) 2004-2019 The FreeBASIC development team.
standalone
target:       win64, x86-64, 64bit
usage: fbc [options] <input files>
input files:
  *.a = static library, *.o = object file, *.bas = source
  *.rc = resource script, *.res = compiled resource (win32)
  *.xpm = icon resource (*nix/*bsd)
options:
  @<file>          Read more command line arguments from a file
  -a <file>        Treat file as .o/.a input file
  -arch <type>     Set target architecture (default: 486)
  -asm att|intel   Set asm format (-gen gcc|llvm, x86 or x86_64 only)
  -b <file>        Treat file as .bas input file
  -c               Compile only, do not link
  -C               Preserve temporary .o files
  -d <name>[=<val>]  Add a global #define
  -dll             Same as -dylib
  -dylib           Create a DLL (win32) or shared library (*nix/*BSD)
  -e               Enable runtime error checking
  -earray          Enable array bounds checking
  -eassert         Enable assert() and assertwarn() checking
  -edebug          Enable __FB_DEBUG__
  -edebuginfo      Add debug info
  -elocation       Enable error location reporting
  -enullptr        Enable null-pointer checking
  -ex              -e plus RESUME support
  -exx             -ex plus array bounds/null-pointer checking
  -export          Export symbols for dynamic linkage
  -forcelang <name>  Override #lang statements in source code
  -fpmode fast|precise  Select floating-point math accuracy/speed
  -fpu x87|sse     Set target FPU
  -g               Add debug info, enable __FB_DEBUG__, and enable assert()
  -gen gas         Select GNU gas assembler backend
  -gen gcc         Select GNU gcc C backend
  -gen llvm        Select LLVM backend
  [-]-help         Show this help output
  -i <path>        Add an include file search path
  -include <file>  Pre-#include a file for each input .bas
  -l <name>        Link in a library
  -lang <name>     Select FB dialect: fb, deprecated, fblite, qb
  -lib             Create a static library
  -m <name>        Specify main module (default if not -c: first input .bas)
  -map <file>      Save linking map to file
  -maxerr <n>      Only show <n> errors
  -mt              Use thread-safe FB runtime
  -nodeflibs       Do not include the default libraries
  -noerrline       Do not show source context in error messages
  -noobjinfo       Do not read/write compile-time info from/to .o and .a files
  -nostrip         Do not strip symbol information from the output file
  -o <file>        Set .o (or -pp .bas) file name for prev/next input file
  -O <value>       Optimization level (default: 0)
  -p <path>        Add a library search path
  -pic             Generate position-independent code (non-x86 Unix shared libs)
  -pp              Write out preprocessed input file (.pp.bas) only
  -prefix <path>   Set the compiler prefix path
  -print host|target  Display host/target system name
  -print fblibdir  Display the compiler's lib/ path
  -print x         Display output binary/library file name (if known)
  -print sha-1     Display compiler's source code commit sha-1 (if known)
  -profile         Enable function profiling
  -r               Write out .asm/.c/.ll (-gen gas/gcc/llvm) only
  -rr              Write out the final .asm only
  -R               Preserve temporary .asm/.c/.ll/.def files
  -RR              Preserve the final .asm file
  -s console|gui   Select win32 subsystem
  -showincludes    Display a tree of file names of #included files
  -static          Prefer static libraries over dynamic ones when linking
  -strip           Omit all symbol information from the output file
  -t <value>       Set .exe stack size in kbytes, default: 1024 (win32/dos)
  -target <name>   Set cross-compilation target
  -title <name>    Set XBE display title (xbox)
  -v               Be verbose
  -vec <n>         Automatic vectorization level (default: 0)
  [-]-version      Show compiler version
  -w all|pedantic|<n>  Set min warning level: all, pedantic or a value
  -Wa <a,b,c>      Pass options to 'as'
  -Wc <a,b,c>      Pass options to 'gcc' (-gen gcc) or 'llc' (-gen llvm)
  -Wl <a,b,c>      Pass options to 'ld'
  -x <file>        Set output executable/library file name
  -z gosub-setjmp  Use setjmp/longjmp to implement GOSUB
  -z valist-as-ptr Use pointer expressions to implement CVA_*() macros
PS C:\Software\WinFBE Suite\FreeBASIC-1.07.1-gcc-5.2>

The compiler seems to run but nothing is produced.
Logged

Dennis Hoskins

  • Little Newbie
  • *
  • Posts: 12
  • FF3 User
Re: Compiling Win64 Windows DLL
« Reply #7 on: May 19, 2020, 10:32:56 AM »

Thank you Paul,
The space in the folder name was the problem.
Functioning now.
Dennis
Logged