hi there guys ,
i was trying to convert the FutureComposer library from C++ to MASM32. when i tried to initiate the fcplay library , play the FC tune and to compile it, i get following errors:
bones.obj : error LNK2001: unresolved external symbol _fc14play_PlaySong@16
bones.obj : error LNK2001: unresolved external symbol _fc14play_Close@0
does this have to do with a newer SDK ? the lib is actually for VS2015. here is the attachemnt where i tried to convert it to MASM32.
and here is the original source code Rbz made for C++ , sorry for double post , got an attachment error saying the files were too large.
According to this post (https://pastebin.com/cb51yaDD), fc14play_PlaySong has three arguments, not four. Adjust your header accordingly, and the error will disappear. However, this does not apply to fc14play_Close :sad:
tried that , still got this error tho but different error :
bones.obj : error LNK2001: unresolved external symbol _fc14play_PlaySong@12
bones.obj : error LNK2001: unresolved external symbol _fc14play_Close@0
Looks like the usual C++ mess :sad:
With
fc14play_PlaySong PROTO C :DWORD,:DWORD,:DWORD
; void __cdecl fc14play_Close(void);
fc14play_Close PROTO C
and the Micros*t linker, I end up with fatal error LNK1171: unable to load c2.dll
So, where is c2.dll?
Quote from: jj2007 on March 28, 2021, 07:45:54 AM
Looks like the usual C++ mess :sad:
With
fc14play_PlaySong PROTO C :DWORD,:DWORD,:DWORD
; void __cdecl fc14play_Close(void);
fc14play_Close PROTO C
and the Micros*t linker, I end up with fatal error LNK1171: unable to load c2.dll
So, where is c2.dll?
well, mine says this:
LINK : fatal error LNK1196: invalid or corrupt import object: unknown version
Quote from: r0ger on March 28, 2021, 07:48:42 AMwell, mine says this:
LINK : fatal error LNK1196: invalid or corrupt import object: unknown version
Yes, that's the message with older linkers. A recent M$ link.exe understands the object format but will complain about the missing c2.dll. You seem to have VS2015, find its linker and put it into \Masm32\bin, with the dlls it needs.
Compiled with Pelles C v8 and stdcall
source: https://pastebin.com/VHxZ58UC
Hi
Maybe I can help a bit. I was able to compile it using the right prototypes. I translated fc14play_v1.27.h from your upload to fc14play_v1.27.inc. This solved the naming decoration issues. :biggrin:
Additionally I needed to add a lot of C/C++ stuff required for the fc14play_v1.27.lib
includelib C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\libcmt.lib
includelib C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\oldnames.lib
includelib C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\libvcruntime.lib
includelib C:\Program Files (x86)\Windows Kits\10\Lib\10.0.16299.0\ucrt\x86\libucrt.lib
includelib C:\Program Files (x86)\Windows Kits\10\Lib\10.0.16299.0\um\x86\Uuid.Lib
and then
includelib fc14play_v1.27.lib
include fc14play_v1.27.inc
include classic.inc
and finally
...
invoke fc14play_PlaySong, addr fctune, sizeof fctune, 44100
...
Unfortunately I got a GPF when the fc14play_v1.27.lib called a malloc. At that point I stopped because I have no knowledge of the library and how to properly set it up. :rolleyes:
Regards, Biterider
With msvc 2019
This works in Windows 7
missing function round in WDDK 7.10int round(double number)
{
return (number >= 0) ? (int)(number + 0.5) : (int)(number - 0.5);
}
Windows Driver Kit Version 7.1.0 (http://masm32.com/https://www.microsoft.com/en-us/download/details.aspx?id=11800)
Quote from: TimoVJL on March 28, 2021, 06:40:03 PM
Compiled with Pelles C v8 and stdcall
source: https://pastebin.com/VHxZ58UC
I got it compiled adding PROTO C somewhere, but it looked wrong. Pastebin plays foul on me, it freezes my browser...
Hi
I finally got it working. What was missing was the CRT initialization. :icon_idea:
Attached the complete app and the binary using the ObjAsm framework.
It can be easily converted into plain MASM.
Biterider
hi biterider,
thanks for making this fc replayer to work on assembly :)
but where do i get these Visual Studio 14.0 libs that you've inserted ?
can you give me a link to the installer of the MS Visual studio 14 please ? and the "Windows Kits"?
Hi r0ger
I got the SDK files from the VS installer, but you can also get it from the internet. Just google for them.
It is not necessary to use the versions that I used. Just find where they are on your system and make sure they are from the same version/distribution.
Just for fun, I added the horizon data and recompiled the app. I suspect the data is .fc files imported into the .const section.
Biterider
Hi
I found some .fc files here http://xmms-fc.sourceforge.net/ (http://xmms-fc.sourceforge.net/).
Importing the binary content into the .const section does the trick.
Bin2inc.exe is the right tool, but incbin can also be used with less effort:
.const
fctune label BYTE
incbin <.\modules\Arcane-Theme.fc>
fctunesize = $ - fctune
Unfortunately, not that many .fc files are currently available.
Biterider
already inserted these libs that are required , and i'm still getting this error when i tried to implement it in masm32 .
LINK : fatal error LNK1196: invalid or corrupt import object: unknown version
i think i'm gonna try with fcplay 1.29 instead, because it only has a lot of stdcalls and the C++ headers can be easily ported in masm and can be compiled with it without any problems.
Quote from: Biterider on March 29, 2021, 04:15:45 AM
Hi
I found some .fc files here http://xmms-fc.sourceforge.net/ (http://xmms-fc.sourceforge.net/).
Importing the binary content into the .const section does the trick.
Bin2inc.exe is the right tool, but incbin can also be used with less effort:
.const
fctune label BYTE
incbin <.\modules\Arcane-Theme.fc>
fctunesize = $ - fctune
Unfortunately, not that many .fc files are currently available.
Biterider
Hi Biterider,
perhaps this is a copy of that archive
https://github.com/slippyex/TinyFC-Replayer/blob/master/test_modules/test_modules.zip
P.S. Is it possible to recode .mp3 format to .fc?
since i've already ported fc14play v1.29 from c++ to masm32, now all i need to insert i think , is crt.lib , so i get this error :
LINK : fatal error LNK1104: cannot open file "crt.lib"
do i need to get this lib from a new SDK ?
Try copying/renaming \Masm32\lib\msvcrt.lib
added these commands into the linker : /NODEFAULTLIB:crt.lib /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:oldnames.lib
, and then i've included msvcrt inc and lib, libvcruntime.lib, ucrt.lib and Uuid.lib , then i've got this error :
fc14play_v1.29.lib(fc14play v1.29.obj) : error LNK2001: unresolved external symbol ___ftoll
now what lib should i need to use now ?
jj2007 , i tried renaming the msvcrt.lib to crt.lib and i get 2 __ftoll and _fltused errors.
Hi
@LiaoMi: Thanks for the link. The archive contains these and many other files :thumbsup:
I don't think you can easily convert a .mp3 to a .fc file, but I've learned never to say that something is not possible :biggrin:
@ R0ger: CRT & Co are not easy to setup. If you show us your code, we can try to fix it.
Biterider
oh yeah, almost forgot, here it is.
Hi R0ger
I checked your project, but unfortunately, the files you need are not part of the MASM32 distribution. You need to take them from the Windows SDK. You will also need a newer linker that is compatible with the FC-library.
Even if you've met all of these requirements, your app won't run. There are additional bugs that you need to find out. I changed the code so that the sound plays for a few seconds when the app starts. This is how to check if the library works okay.
I send you the modified source code for further study.
Regards, Biterider
Quote from: r0ger on March 29, 2021, 06:42:16 AM
added these commands into the linker : /NODEFAULTLIB:crt.lib /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:oldnames.lib
, and then i've included msvcrt inc and lib, libvcruntime.lib, ucrt.lib and Uuid.lib , then i've got this error :
fc14play_v1.29.lib(fc14play v1.29.obj) : error LNK2001: unresolved external symbol ___ftoll
now what lib should i need to use now ?
jj2007 , i tried renaming the msvcrt.lib to crt.lib and i get 2 __ftoll and _fltused errors.
Oops, that was for Pelles C
This one is for msvc and CDECL, so inc file needs that C in function prototype.
http://masm32.com/board/index.php?topic=9261.msg101692#msg101692
EDIT: fc14_v1.29s.lib is just 32-bit stdcall version
Hi TimoVJL
It would be great if you could compile the static library v1.29 for 32 and 64 bit (release, stdcall) :biggrin:
Biterider
Quote from: Biterider on March 29, 2021, 09:14:11 PM
Hi TimoVJL
It would be great if you could compile the static library v1.29 for 32 and 64 bit (release, stdcall) :biggrin:
Biterider
You mean for crtmt.lib ?
Link option -nodefaultlib:msvcrt.lib is useful.
EDIT: those was built with -Gz -O2 and using WDK 7.10 headers, so with masm32 libraries, just use -nodefaultlib:crtmt.lib
Hi TimoVJL
Perfect!, thanks for the files :thup:
Biterider