Proof Of Progress
Search ProofOfProgress Blog
Wednesday, August 9, 2017
Duel Boot and 0Byte Flash Drive
Tuesday, August 8, 2017
CGO GoLang - First Time
I am not sure how CGO works, but for whatever reason I need to OMIT including implementation files for "go build" to work. The code I am about to post will fail if I add ncludes, giving an error about "multiple inclusions"
--------------- main.go (start)-------------------- package main /* #include "whatever.h" */ import "C" import "fmt" //:It works, but I don't know why. //:Removed include "whatever.c" and build works, //:but not "go run". Linker just assumes that //:existance of whatever.h means existance of //:a whatever.c //:03_CG_IS_NOT_GO.pdf suggests you can do //:a forward declaration like so in golang code: //:func myPrint(i C.int); func main(){ DoFoo(); } //export myprint func myprint(i C.int) { fmt.Printf("i = %v\n", uint32(i)) } func DoFoo() { C.NotWorking() } --------------- main.go (end)---------------------- --------------- whatever.h (start)----------------- #pragma once #ifndef HEADER_DOT_H #define HEADER_DOT_H extern void NotWorking(); extern void myprint(int i); // Will get linker error if you uncomment // this. When commented out, " go build " // works, but "go run" fails. // // Go build is assuming that a // "whatever.c" exists, even though I // do not mention it anywhere. // // XXX XXX #include "whatever.c" XXX XXX #endif --------------- whatever.h (end)------------------- --------------- dontassume.c (start)--------------- #ifndef WHY_IS_THIS_NOT_WORKING #define WHY_IS_THIS_NOT_WORKING extern void myprint(int i); void NotWorking() { int i; for (i=0;i<20;i++) { myprint(i); } } #endif --------------- dontassume.c (end)----------------- File Structure: [Folder: export_func ] / dontassume.c / main.go / whatever.h ( We have a folder called "export_func" ) ( with the files, "dontassume.c" , ) ( "main.go", and "whatever.h" directly in ) ( that folder. ) When you CD into export_func and run $ go build The result is an executable called export_func.exe. You can then run it via: $ ./export_func.exe Note: I am running go 1.8.1 on Windows 10. If I #include dontassume.c in any of the source files, the build will fail giving me this erronious output:
JMIM@DESKTOP-JUDCNDL MINGW64 /g/MY_GOPATH/src/bitbucket.org/JMIM/JM_CGO/TEST01/export_func (master) $ go build # bitbucket.org/JMIM/JM_CGO/TEST01/export_func C:\Users\JMIM\AppData\Local\Temp\go-build112659030\bitbucket.org\JMIM\JM_CGO\TEST01\export_func\_obj\main.cgo2.o:main.cgo2.c:(.text+0x0): multiple definition of `NotWorking' C:\Users\JMIM\AppData\Local\Temp\go-build112659030\bitbucket.org\JMIM\JM_CGO\TEST01\export_func\_obj\_cgo_export.o:_cgo_export.c:(.text+0x0): first defined here C:\Users\JMIM\AppData\Local\Temp\go-build112659030\bitbucket.org\JMIM\JM_CGO\TEST01\export_func\_obj\dontassume.o:dontassume.c:(.text+0x0): multiple definition of `NotWorking' C:\Users\JMIM\AppData\Local\Temp\go-build112659030\bitbucket.org\JMIM\JM_CGO\TEST01\export_func\_obj\_cgo_export.o:_cgo_export.c:(.text+0x0): first defined here collect2.exe: error: ld returned 1 exit status
Thursday, July 27, 2017
Argh.
Tuesday, June 28, 2016
LendingClub.com Account number confirmation does not match.
Saturday, May 7, 2016
TSQL Can be done on stack overflow?
Friday, April 22, 2016
Having trouble invoking static methods in VB.net
Static Methods. AKA: "shared" in vb.net termonology. Here is the paste bin: http://pastebin.com/RC9p74sE
Update: I was being stupid. The static methods were throwing an error because I was writing the statements within the class, but NOT within a function. Fix here:http://pastebin.com/2MsCzaMm
CodeEval VB.Net Sample Code Bug Fix
Reason: The sample code for VB.NET has a typo in it. GetCommandLneArgs should be: GetCommandLineArgs
Module Challenge Sub Main() Dim test As String Using fileStream As New System.IO.StreamReader(System.Environment.GetCommandLneArgs()(1)) Do Until fileStream.EndOfStream test = fileStream.ReadLine 'test' represents the test case, do something with it ... ... Loop End Using End Sub End Module
Thursday, April 7, 2016
Entity Data Model Wizard Shortcut
Tuesday, April 5, 2016
Get Class Of Active Window AHK
So, I was reading all through the documentation looking for a: WinGetActiveClass Since there is a WinGetTitle And a WinGetClass Turns out: WinGetClass's behavior IS to get the class of the active window. This sample code will display the class name of the active window when you press the enter key: enter:: { ;theClass = class of active window. WinGetClass, theClass, A msgBox %theClass% }
Friday, March 25, 2016
Friday, March 18, 2016
Close Properties Panel Shortcut Visual Studio
Close Solution Explorer Shortcut Visual Studio
Close ToolBox Visual Studio
Monday, March 14, 2016
Stood Vector
Tuesday, March 1, 2016
Delete Character
Monday, February 29, 2016
Enforce classes have same static method c++
All my classes must have a method called unitTest in DEBUG mode. This is because I don't want my test code in a separate library.
Separation of concerns is nice and all. But I think that separation also makes it more likely that your test library code will decay.
This might be what I need: http://stackoverflow.com/questions/9346076/static-template-functions-in-a-class
Basically, extend from a header-only class that defines no implementation. And have the function within that class be templated.
Something like:
public: template< typename T> static double foo( vectorarr );
In the header, without any implementation.
Can you extend from a class with no implementation? I bet you can. Need to look into that.
Maybe I need a "pure virtual function"? https://blogs.msdn.microsoft.com/oldnewthing/20131011-00/?p=2953
But that specifies type... Do I need a "pure virtual template function"? That sounds fancy and over complicated.
Yes, you can. http://stackoverflow.com/questions/8919566/are-pure-virtual-methods-allowed-within-a-template-class
Monday, February 15, 2016
Ownership of pointers in c++ and borrow boxes
Sunday, February 14, 2016
Overload = operator c++
Are structs initialized to zero?
object lifetime of structs c++
myStruct getStruct(){ myStruct val; return val; }Will the instance of myStruct be killed immediately after leaving the function scope? Turns out, this works with structs. Pretty sure it would not work if it were a class. Also strange is that it seems like... All the members of a struct are initialized? Rather than having whatever random data was there before hand? Or maybe I am just lucky... Might want to explicitly init values by specifying a constructor.
My Blog List
-
Goodbye to All That (2014)9 years ago
-
Pen To Paper11 years ago
-
Moving!12 years ago
-
-