adding library to linker
Monkey Targets Forums/Desktop/adding library to linker
| ||
Hi all is there a way to add library to linker ? |
| ||
only with the c++ target #CC_OPTS = "-lname" #CC_LIBS = "-ldllname" |
| ||
Not directly through Monkey. You would have to edit either a makefile or the Visual Studio solution to do it. I think Adam Redwoods mentioned something in one of the post a few months back about a push to git for a directive to add libraries to the build process for c++ tools target. Edit: Adam must have posted just before me. |
| ||
thanks you AdamRedwoods , dawlane so what about DeskTop? Edited : no problem i will extend DeskTop to accept library to link with. thanks. |
| ||
Hi all I have implemented it for desktop with gcc. works like Blitzmax example Import -lcomdlg32 here is the changes ============== with gcc makefile change this LDLIBS= -lopengl32 -lOpenAL32 -lws2_32 to that LDLIBS=$(CCLIBS) -lopengl32 -lOpenAL32 -lws2_32 with parseMain function Import will be like that Case "import" NextToke If _toke = "-" Local line := _toke NextToke While _toke <> "~n" line += _toke NextToke Wend CC_Libs = line Else If _tokeType=TOKE_STRINGLIT ImportFile EvalConfigTags( ParseStringLit() ) Else ImportModule ParseModPath(),attrs Endif in file translator.monkey put this line Global CC_Libs$ |
| ||
so what about DeskTop? i don't know why #CC_OPTS is not in desktop. my guess is that it isn't so easy to pass flags to VS C++/C#. you can pass CCFLAGS to Xcodebuild on OSX. |
| ||
As MSBuild is used to create desktop and xna applications. The Monkey compiler (trans) would need to edit the project properties (using /p: ) via the command line or construct a xml include file on the fly to be added as a parameter in the command line. Like wise, using the gnu tool chain there is nothing to stop additional compiler options being passed as a variable to the makefile as long as the makefile is written in such away to allow for it. |
| ||
actually adding library to be included when linking stage with MSVC is very easy. just emit the following line in c++ source code to include library #pragma comment(lib, "MyLibName.lib" ) any way i will remake import keyword to allow that for MSVC. |
| ||
Import -lcomdlg32 Did you try the following on Windows? #LIBS+="Kernel32.lib" #LIBS+="User32.lib" #LIBS+="comdlg32.lib" Extern Function Beep(dwFreq:Int, dwDuration:Int) Function MessageBeep(uType:Int) Public Function Main:Int() Beep(800,300) MessageBeep(-1) Return 0 End |
| ||
thanks Danilo for that. actually i was having no idea about that , so it's okay for MSVC. for gcc my ext is okay , but is there a way to know which one is used MSVC or GCC at parse time. |